> -----Original Message----- > From: Denis Vlasenko [mailto:[EMAIL PROTECTED] > Sent: Saturday, July 14, 2007 8:02 PM > To: [email protected]; [EMAIL PROTECTED] > Subject: Re: Problem with ash -n non-zero length string test > > 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
Thank you for your reply. I didn't know that variables must be double-quoted. I'm learning something everyday! :>) _______________________________________________ busybox mailing list [email protected] http://busybox.net/cgi-bin/mailman/listinfo/busybox
