1. Computing

Using the Command Line

By , About.com Guide

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
  1. About.com
  2. Computing
  3. Ruby
  4. Beginning Ruby
  5. Using the Command Line

©2013 About.com. All rights reserved.