Why are the bash -n and -z test operators not inverses for $@
"$@"
doesn't do what you expect. It's not a different form of "$*"
, it expands to the quoted list of arguments passed to the current script.
If there are no arguments, it expands to nothing. If there are two arguments a
and b c
, then it expands to "a" "b c"
(i.e. it preserves whitespace in arguments) while "$*"
expands to "a b c"
and $*
would expand to a b c
(three words).