A: The first way keeps the script from reading anything else from its input. Consider the zip script:
A:
while read word do echo $word | sed s/foo/bar/ done
If run as sh zip
, it will read from your terminal, replacing foo
with bar
. If run as sh < zip
, it will exit right away, since
after reading the script, there's no input left.
- in net.unix on Usenet, 29 December 1984