[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test -n "${var+set}"?
From: |
Larry Jones |
Subject: |
Re: test -n "${var+set}"? |
Date: |
Wed, 18 Feb 2004 14:52:35 -0500 (EST) |
Derek Robert Price writes:
>
> Got it now. I read the bash man page as stating that this construct
> wouldn't echo "set" for a variable set to the empty string.
That's because the man page is talking about :+ rather than +:
When not performing substring expansion, bash tests for a
parameter that is unset or null; omitting the colon results in a
test only for a parameter that is unset.
Viz.:
$ var=
$ echo ${var+set}
set
$ echo ${var:+set}
$
-Larry Jones
Some people just don't have inquisitive minds. -- Calvin