Subject: Re: "for" behaviour in /bin/sh
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Simon J. Gerraty <sjg@quick.com.au>
List: current-users
Date: 07/14/1998 10:50:42
>> So is the "correct" thing to do to replace
>> for f in ${LIST}; do
>> echo $f
>> done
Any shell which does not handle the above for LIST='' is broken.
Note that with LIST=""
for f in $LIST; do echo $f; done
is NOT the same as
for f in ; do echo $f; done
The first is syntactically correct, and any shell that vomits should
be fixed. Unless you are talking about:
eval "for f in $LIST; do echo $f; done"
In which case an empty LIST will result in a syntax error, but that's
a different ball game.
Don't "fix" (or rather frob) the script, fix the shell or replace it.
--sjg