It seems the line in Bash
set -- $*
is to re-parse the argument using the new IFS. Example:
try() {
IFS=:
set -- $*
echo 1st, $1
echo 2nd, $2
echo 3rd, $3
}
and then
$ try a:b:c
1st, a
2nd, b
3rd, c
because without that line, the output would be
$ try a:b:c
1st, a:b:c
2nd,
3rd,
But this code doesn't work in Zsh. Is there a way to make it work on both Bash and Zsh?