OT: Need some shell scripting hints ;)
Atro Tossavainen
yellowdog-general@lists.terrasoftsolutions.com
Thu Oct 2 03:23:01 2003
> I did experience the "whitespace problem" with Nathan's solution, which
> was my first attempt too, but did not come up with Jason's and Atro's
> solution ;) I fumbled around with:
>
> while [ read <TextFile.txt LINE ]
You would have won the Useless Use of Test award (remotely related to
the Useless Use of Cat award). "[" is "test", which is unnecessary
here (as "read", just like any other command, returns a result code
which is immediately usable to while).
Your version would have been fine if the "<textfile.txt" was else-
where. Having it there in the loop means that the "<" is evaluated
every time and as a result, you start reading the file from line 1
every round in the loop. That's why it has to be after "done", or
outside the text of the script altogether as I suggested.
--
Atro Tossavainen (Mr.) / The Institute of Biotechnology at
Systems Analyst, Techno-Amish & / the University of Helsinki, Finland,
+358-9-19158939 UNIX Dinosaur / employs me, but my opinions are my own.
< URL : http : / / www . helsinki . fi / %7E atossava / >
File attachments NOT welcome unless agreed to beforehand.