Bash has a bug: ${+} is syntactically invalid, as evidenced by the error message when running the script, yet using 'set -n' was not able to flag it as an error.
$ echo $BASH_VERSION 4.2.8(1)-release $ bash -c 'echo ${+}'; echo $? bash: ${+}: bad substitution 1 $ bash -cn '${+}'; echo $? 0 $ ksh -cn '${+}'; echo $? ksh: syntax error at line 1: `+' unexpected 3 Meanwhile, a feature request: since $+ outputs a literal "$+", it is proof that + cannot be a valid variable name. Bash should follow ksh' lead by having 'set -n' warn about suspicious but usable constructs, at least when --posix is not in effect. $ bash -c 'echo $+' $+ $ bash -cn '$+'; echo $? 0 $ ksh -cn '$+'; echo $? ksh: warning: line 1: $ not preceded by \ 0 -- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature