[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: [LI] Is there a bug in Bash2



On Thu, Dec 30, 1999 at 12:06:05AM +0530, Soumava Das wrote:
> Dear Linux users, 
> 	I found that the command " test -n $var " ( to test whether the 
> string  variable is non -empty ) does not work. The expression " [ -n 
> $var ] " where  var is a string variable always evaluates true . But 
> the complementary  
> " test -z $var " works as expected . Is this a bug in the shell or am I 

Put $var inside quotes, like below, and it'll all work.
    test -n "$var"
    [ -n "$var" ]
--------------------------------------------------------------------
The Linux India Mailing List Archives are now available.  Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.