semi OT: sh scripting problem
Tom Evans
tevans.uk at googlemail.com
Wed Aug 1 15:00:49 UTC 2007
On Wed, 2007-08-01 at 10:35 -0400, Robert Huff wrote:
> (This is probably a FAQ, and I'll take a pointer (or even the
> magic words to identify the problem) instead of an answer.)
> Let's suppose I have a file FILE, with contents:
>
> foo
> bar grill
> baz
>
> If I do "cat FILE", everything comes out fine.
> If, however, I write a script:
>
>
> #!/bin/sh
>
> for i in `cat FILE`
cat FILE | while read i
> do
> .
> .
> .
> .
> done
>
> $i is set to
>
> foo
> bar
> grill
> baz
>
> Is there a way within the script - or, failing that, by
> modifying FILE - to not break at the whitespace?
>
>
> Robert Huff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20070801/ca9fdaf2/attachment.pgp
More information about the freebsd-questions
mailing list