shift in for loop changes loop parameters
Bug #2002250 reported by
Oğuz İsmail Uysal
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
mksh |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
This script
set -- 1 2
for x; do
echo $x
shift $#
done
should print
1
2
according to POSIX. And it does so on every other shell except pdksh clones. On mksh the output is
1
mksh
which is wrong.
To post a comment you must log in.
Confirm-ish, but it DTRT if you write
for x in "$@"; do
which the autoconf manual says to use anyway; however,
for x
do
doesn’t work, which is their second form.
This seems to be something inherited from pdksh. I’ll look into it.