This is a FreeBSD 7.x system running GNU bash version 4.0.
In Bash, the set -u option can force a shell to print an error if it encounters an unset variable, like this:
$ set -u
$ echo $THISISUNSET
-su: THISISUNSET: unbound variable
$ echo $?
1
However, I am also encountering this same error for $*:
$ echo $*
-su: $*: unbound variable
$ echo $?
1
$ echo $@
-su: $@: unbound variable
The Bash Manual 4.3.1 The Set Builtin specifically says that set -u ignores $* and $@:
-u Treat unset variables and parameters other than the special parameters ‘@’ or ‘*’ as an error when performing parameter expansion. An error message will be written to the standard error, and a non-interactive shell will exit.
How can I fix this?