|
From: | Jonathan Kamens |
Subject: | Re: "[ -n ${emptyvariable} ]" returns success |
Date: | Thu, 20 Sep 2007 20:13:53 -0400 |
User-agent: | Thunderbird 2.0.0.6 (X11/20070911) |
On 09/20/2007 07:46 PM, Paul Jarc wrote:
OK, thanks for the explanation. It makes sense, although I think it's just a little gross. ;-)jik@kamens.brookline.ma.us wrote:foo= [ -n ${foo} ] && echo true Prints "true".That's the correct behavior.
Yes, I know that, but the person who wrote the code in which I noticed this issue apparently does not :-).To avoid pitfalls like this, always quote variable expansions. The [[ command is also less tricky.
Thanks again, jik
[Prev in Thread] | Current Thread | [Next in Thread] |