1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Using the Command Line


7 of 10

Use Pipe Characters to Redirect Input

Similarly, by using the < character instead of the > character you can redirect any input a Ruby script may read from the keyboard to read from a .txt file. It's helpful to think of these two characters as funnels; you're funneling output to files and input from files.

C:\scripts>ruby example.rb <input.txt

©2014 About.com. All rights reserved.