Hi everyone, and welcome to another edition of IBOTD (IFS-bug-of-the-day), featuring everyone's favorite Bourne shell kludge: word-splitting!
On today's episode - inconsistencies within assignments that depend upon quoting. Though I can't take credit for discovering this -- it was pointed out to me by some guys on IRC after demonstrating some other stuff. And a quick test: function expassign { typeset -a a a=("$@") typeset var asn while IFS= read -r asn; do IFS=: command eval "$asn" printf '%-14s... %s\n' "$asn" "$var" done <<\EOF var=${a[*]} var="${a[*]}" var=$* var="$*" var=${a[@]} var="${a[@]}" var=$@ var="$@" EOF } ${ZSH_VERSION+:} false && emulate ksh expassign one:::two three:::four Bash output: # I think... var=${a[*]} ... one two three four # bad var="${a[*]}" ... one:::two:three:::four # good var=$* ... one:::two:three:::four # good var="$*" ... one:::two:three:::four # good var=${a[@]} ... one two three four # bad var="${a[@]}" ... one:::two three:::four # good var=$@ ... one two three four # bad var="$@" ... one:::two three:::four # good Zsh and pdkshes produce: one:::two:three:::four For all of the above, which I think is wrong for the last 4. ksh93 produces: one:::two three:::four for the last 4, which I think is correct. -- Dan Douglas