[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
problem with test cmd
From: |
Claudio Lapidus |
Subject: |
problem with test cmd |
Date: |
Tue, 13 Feb 2001 23:33:52 -0300 |
Hi all,
Probably this is not new for you, but certainly it is for me. Please take a
look at the following:
bash$ MYVAR=rr
bash$ [ -n $MYVAR ]
bash$ echo $?
0
bash$ MYVAR=
bash$ [ -n $MYVAR ]
bash$ echo $?
0
bash$ unset MYVAR
bash$ [ -n $MYVAR ]
bash$ echo $?
0
bash$
So in the first case test returns zero, which is correct for the current
value of MYVAR, but in the second and third cases it remains returning zero,
which seems wrong to me. I also tested with -z, which seems to be working
right in all cases. BTW, [ -n '' ] (i.e. literal string, no expansion) works
correctly too.
Any thoughts?
regards,
cl.
PS. This is run from bash 2.02 on Solaris, but it looks the same in 1.14 on
a linux box and in 2.04 on Win98 too (the Cygwin build).
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
- problem with test cmd,
Claudio Lapidus <=