3 ms·
Man, one of the worst debugging experiences of my life was when we built an extensigble build tool, based on Bash. Most of it worked, but there was always an in
by ljm 7y ago
Man, one of the worst debugging experiences of my life was when we built an extensigble build tool, based on Bash. Most of it worked, but there was always an inconsistency between $* and $@ and there would be PRs that swapped those values around, back and forth.
They were both totally valid; we just hadn't agreed on a calling convention for the tool so people were trying to fix their individual problems based on their own habits.
- mikelward 7y agoThey are not both totally valid. You almost always want "$@". If you're using $* , you're not supporting arguments that contain spaces, and you'll break if arguments contain wildcards. If you're using "$*" , you're treating multiple arguments as a single argument. https://unix.stackexchange.com/a/41595/3169 https://unix.stackexchange.com/a/41595/3169
- a1369209993 7y ago> there was always an inconsistency between $* and $@ There is never a legitimate reason to use $* . Even in the rare cases where you want those semantics (hint: you don't), you should use something like "$(join ' ' "$@")" instead. > They were both totally valid; No, they weren't.