Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

set -A



I think this is a bug in all versions, but if there's some reason
the behaviour could be considered correct, it'd be nice if it at
least worked like ksh in emulation mode.  I recently had some trouble
getting a ksh script to work properly in zsh, as illustrated by:

unset arr
set -A arr "${arr[@]}" first
[ ${#arr[@]} = 2 ] && echo "arr[0]='${arr[0]}' arr[1]='${arr[1]}'"

Note the null entry on the start of the array.  I believe the above
should work as in ksh, and consistently with positional parameters,
like this:

set --
set -A arr "$@" first
echo arr now has only ${#arr[@]} element

Secondly, I have more of an observation than a bug report that better
fits the subject since it has to do with parsing after the -A of set.
	set -A arr -x
puts -x into the beginning of the array, whereas ksh treats the -x as
an option to set instead.  In ksh
	set -A arr -- -x
would get around that, but the same command in zsh now put the -- into
the array.  I think either way could be considered correct, but it
would be nicer if the same command had the same effect in both shells.

-- 
Paul Ackersviller



Messages sorted by: Reverse Date, Date, Thread, Author