01-23-04 10:02 PM
In article <baea5fa.0309170633.35562e77@posting.google.com>, Rob Baxter wrote:quote:
> Thanks guys - I have what you've written working now but don't
> understand how it is working. I've used a greater than sign to
> redirect the output of several different utilities to a file in the
> past, but I don't know what a less than sign is doing or how it works.
> Can you explain that a bit?
The read command that I used in my post reads data from standard
input. Using "<data" I can replace standard input with the
contents of the file "data", simply speaking.
Any command or program that expects to be fed data on standard
input may have its data fed from a file in this way. For
example, the tr command may be used this way:
tr '$' '£' <myfile >new.myfile
which will replace all occurances of '$' with '£' in the file
"myfile". The result is written to "new.myfile". If no
redirection had been doen, all input and output would have been
to/from the console.
Redirection of standard input and standard output is a basic
concept of shell scripting.
--
Andreas Kähäri
[ Post a follow-up to this message ]
|