In many cases you don't want output to be printed straight to the screen, but to be filtered or redirected to a file. Likewise, you may want the input to a program to come from a file, rather than you having to type it in from the keyboard. For this you use pipes and arrows.
pascal> date > today.txtwill put the results of the date command into file today.txt, rather than onto the monitor. If there was already a file by that name, its previous contents will be wiped out, and replaced with the new command.
If you wish to append stdout to the end of an existing file, without destroying that file's previous contents, then use ``>>>'' instead, e.g.
pascal> date >> today.txt
pascal> a.out
Enter the coefficient of x^2: 1
Enter the coefficient of x: 3
Enter the constant coefficient: 2
Root #1 is x= -1.000000
Root #2 is x= -2.000000
Rather than typing in the three numbers yourself,
you could put the numbers into a file, say
``coeffs.txt'', and then run the program
like this:pascal> a.out < coeffs.txt Root #1 is x= -1.000000 Root #2 is x= -2.000000
pascal> ran3 | a.out Root #1 is x= 317.137829 Root #2 is x= -0.702707
pascal> man -k edit | sort -u | wc | a.outThis 4-part command starts with the man -k command, which lists all the Unix commands related to the keyword ``edit''. This list is not shown on the monitor; rather, it is sorted and duplicate lines thrown out by the sort -u command. This result, in turn, is sent to wc (word count) which outputs the number of lines, words, and characters in the sorted list. Finally, these 3 numbers are used as input to a.out, which treats them as coefficients and produces the two roots of a quadratic equation as in the examples above. These two roots are the only output which appears on the monitor; all the intermediate steps are temporary in nature, and not displayed or saved in a file.