On Saturday 07 July 2007 22:34, Dallas Clement wrote:
> Hello All,
> 
> I'm experiencing some weird things when trying to use -n to test for a
> non-empty string as in the following example.
> 
> boot_drive_name=""
> 
> if [ -n $boot_drive_name ]; then
>    retval=0
> else
>    echo "Could not determine boot drive name."
> fi
> 
> To my surprise, this condition evaluates true and I do not see my echo
> message.

No bug here:

# cat zz.sh
boot_drive_name=""
if [ -n $boot_drive_name ]; then
 retval=0
else
 echo "Could not determine boot drive name."
fi
# ash zz.sh
# bash zz.sh

It's error in script. You need to use

if [ -n "$boot_drive_name" ]; then...
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to