Re:Use the Unofficial Bash Strict Mode (Unless You Love Debu...
by hibbelig on Friday March 18, 2016 @05:39PM
(#11315347)
No, $@ is special where $* is regular. Consider the following script foo.sh and call it like so:
The $* part will print one line, the $@ part will print three lines.
I use "$@" often, but to this day I don't fully understand how $@ works...
[ Parent
| on HN ]
Re:Use the Unofficial Bash Strict Mode (Unless You Love Debu...
by kazinator on Friday March 18, 2016 @05:51PM
(#11315450)
Unquoted $@ works exactly like unquoted $* .
Quoted "$* " separates the parameters using the first character stored in IFS, or with nothing if IFS is unset/null. Usually, the first character of IFS is space, giving the impression that "$* " means "separate with spaces"; i.e. that it's just an ordinary quote job around $* (i.e. that it is "regular", in your words).
Quoted "$@" does ... what you clearly understand.