>> On Thu, 28 Oct 2010 09:17:12 -0700,
>> Chip Camden <[email protected]> said:
C> Perhaps someone with more sh fu can transform the 'if' paragraph into a
C> one-liner at least. When I tried to do so, I got an unexpected ; error.
Try this:
#!/bin/sh
test $# -ge 1 && cat $@ | exec $0 && exit 0
IFS=$'\n'
while read data; do
echo "$data"
done
exit 0
Resetting IFS is only necessary if you want to preserve whitespace in
each line. Putting $data in quotes prevents any shell metacharacters
from being expanded.
--
Karl Vogel I don't speak for the USAF or my company
Sign in a New York drugstore: "We dispense with accuracy"
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[email protected]"