mwoehlke <[EMAIL PROTECTED]> wrote:
> Poor Yorick wrote:
>> The following line does not perform the "echo" command.
>> : ${FAKEVAR?} || echo hello
>
> What you probably want is:
> [ "$FAKEVAR" ] || echo hello

That doesn't distinguish between an unset variable and a variable set
to an empty value.  If that distinction is important, you can use:
test "${FAKEVAR+set}" = set

You can also wrap it up in a function for convenience:
is_set() {
  eval "test \"\${${1?}+set}\" = set"
}


paul


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to