Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/distrib



In article <20090918100321.GA1277%apb-laptoy.apb.alt.za@localhost>,
Alan Barrett  <apb%cequrux.com@localhost> wrote:
>On Fri, 18 Sep 2009, David Brownlee wrote:
>> Index: src/distrib/common/runlist.sh
>  [...]
>> +( while [ "X$1" != "X" ]; do
>> +    cat $1
>> +    shift
>> +done ) | awk -f ${NETBSDSRCDIR}/distrib/common/list2sh.awk | ${SHELLCMD}
>
>Why is the while loop necessary?  Why not just use
>
>       awk -f .../list2sh.awk "$@"
>
>As far as I can tell, the only difference between the while loop an my
>suggestion is in the behaviour when there are no args (which might
>never happen, or which can be handled by an additional test), or the
>behaviour when one of the args is an empty string (which I hope never
>happens).

if [ -n "$1" ]; then
        awk -f .../list2sh.awk "$@"
fi

and that "X$1" idiom needs to die as well as using unquoted variables
which will break for strings with whitespace.

christos



Home | Main Index | Thread Index | Old Index