Problem with ash -n non-zero length string test
Yann E. MORIN
yann.morin.1998 at anciens.enib.fr
Sat Jul 7 21:44:30 UTC 2007
Hello Dallas,
Hello all,
On Saturday 07 July 2007 23:34, Dallas Clement wrote:
> if [ -n $boot_drive_name ]; then
> retval=0
> else
> echo "Could not determine boot drive name."
> fi
I'd suggest either one of:
- enclose the variable between double quotes: "$boot_drive_name"
- use this: [ x$boot_drive_name = x ]
I would also enclose the variable b=name between curly brackets:
"${boot_drive_name}"
I would personnally use:
if [ -z "${boot_drive_name}" ]; then
do_error_out
exit 1
fi
do_something_usefull
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software Designer | \ / CAMPAIGN | ^ |
| --==< °_° >==-- °------------.-------: X AGAINST | /e\ There is no |
| http://ymorin.is-a-geek.org/ | (*_*) | / \ HTML MAIL | """ conspiracy. |
°------------------------------°-------°------------------°--------------------°
More information about the busybox
mailing list