Subject: bin/6106: /bin/sh vs {$X:=$Y} in a loop
To: None <gnats-bugs@gnats.netbsd.org>
From: Martin J. Laubach <mjl@emsi.priv.at>
List: netbsd-bugs
Date: 09/05/1998 22:10:20
>Number: 6106
>Category: bin
>Synopsis: Expression {$X:=$Y} uncorrectly eval'd by /bin/sh
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Sep 5 13:20:01 1998
>Last-Modified:
>Originator: Martin J. Laubach
>Organization:
>Release: 1.3.2
>Environment:
System: NetBSD asparagus 1.3.2 NetBSD 1.3.2 (ASPARAGUS) #14: Sat Aug 29 16:16:00 CEST 1998 mjl@asparagus:/home/temp/kernel/sys/arch/i386/compile/ASPARAGUS i386
>Description:
The following piece of shell script
unset LINGUAS
ALL_LINGUAS="en de fr es"
for lang in ${LINGUAS:=$ALL_LINGUAS}; do
echo "lang = $lang"
done
incorrectly produces the following output:
lang = en
lang = de
lang = fr
lang = de
lang = fr
lang = es
>How-To-Repeat:
See above.
>Fix:
Workaround:
X=${LINGUAS:=$ALL_LINGUAS};
unset X
for lang in $X; do
...
>Audit-Trail:
>Unformatted: