semi OT: sh scripting problem
Eric Crist
mnslinky at gmail.com
Wed Aug 1 14:58:44 UTC 2007
On Aug 1, 2007, at 9:54 AMAug 1, 2007, Heiko Wundram (Beenic) wrote:
> Am Mittwoch 01 August 2007 16:35:44 schrieb Robert Huff:
>> Is there a way within the script - or, failing that, by
>> modifying FILE - to not break at the whitespace?
>
> If you're using bash, set IFS to the newline only before looping. I
> guess the
> tcsh also has a similar setting, but I wouldn't know where to look.
>
> ---
> IFS="
> "
>
> for i in `cat file`
> do
> ...
> done
>
This also works for sh. To the OP, simply add the lines above your
for listed above to your script, and it should work. No bash required.
Eric Crist
More information about the freebsd-questions
mailing list