That's not the code you ran. You must have been running
echo "$*" quotes and all, otherwise you'd have never seen the pipes.
$* after the
set didn't remove the equals, it was already gone. If you ran
./script a b --arg=c, $* on line 3 wopuld be the string
a|b|--arg=c and split apart on "|=" into the arguments
"a",
"b",
"--arg", and
"c" The equals sign is already gone, deleted.
So when you do $* after that, it just smashes $1 $2 ... all together with | inbetween:
a|b|--arg|c
Now remember, $* always,
always does this, even if you don't quote it.
You just don't see it without quotes, because the shell splits it. It'd see a|b|--arg|c, give "a" as echo's first argument, "b" as echo's second argument, "--arg" as echo's third argument, and "c" as echo's fourth argument. (echo doesn't split the arguments; that's the shell's job.) echo is not controlled by IFS, and will just put spaces inbetween...