Poor Yorick wrote: > The following line does not perform the "echo" command. > > : ${FAKEVAR?} || echo hello > > This seems inconsistent, since the return status is set to one, not > to mention that the null command is documented to return a zero exit > code. It would be a convenient and concise syntax for acting on > unset variables.
It is, however, as documented and compatible with the legacy (the old Bourne shell behaved this way too) and POSIX shells. `${PARAMETER:?WORD}' If PARAMETER is null or unset, the expansion of WORD (or a message to that effect if WORD is not present) is written to the standard error and the shell, if it is not interactive, exits. Otherwise, the value of PARAMETER is substituted. Because the shell exits the right hand side of the or is not executed. Try this: ( : ${FAKEVAR?} ) || echo hello Bob _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash