This is my code to loop over colon separated values and do something with each value.
f()
{
IFS=:
for arg in $1
do
echo arg: $arg
done
}
f foo:bar:baz
This works fine in most POSIX compliant shells.
$ dash foo.sh
arg: foo
arg: bar
arg: baz
$ bash foo.sh
arg: foo
arg: bar
arg: baz
$ ksh foo.sh
arg: foo
arg: bar
arg: baz
$ posh foo.sh
arg: foo
arg: bar
arg: baz
$ yash foo.sh
arg: foo
arg: bar
arg: baz
But it does not work as expected in zsh.
$ zsh foo.sh
arg: foo:bar:baz
Is zsh in violation of POSIX here?