Using the pipe characters is an important skill to master, as these characters will alter the input or output of a Ruby script. In this example, the > character is used to redirect the output of test.rb to a text file called test.txt instead of printing to the screen.
If you open new test.txt file after you run the script, you'll see the output of the test.rb Ruby script. Knowing how to save output to a .txt file can be very useful. It allows you to save program output for careful examination or to be used as input to another script at a later time.
C:\scripts>ruby example.rb >test.txt