4.2 Redirecting Standard Input

   

UNIX commands can send output anywhere when using output redirection, and they can also get input from places other than the keyboard. Figure 4-3 shows I/O locations in the case of stdin redirection.

Figure 4-3. Standard input redirection.

graphics/04fig03.gif

We use the " less-than " symbol ( < ) for input redirection. Say that you have already created a text file with name myfile . You want to send this text file to a user jane through electronic mail. The easiest way to do this is to ask the mail program to get its input from this file instead of from the keyboard. The process of doing this is as follows .

 $  mail jane <myfile  $ 

The mail program sends an email message to user jane on the current system consisting of the contents of myfile . This is a more convenient way to type messages when you need time to compose them. You just create a file, and when you are satisfied with what you have typed, send it through email.


   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net