[BusyBox] how to do "[ $? -eq 1 ] && echo equal"

Matt Kraai kraai at alumni.carnegiemellon.edu
Wed Apr 11 14:45:02 UTC 2001


On Wed, Apr 11, 2001 at 03:38:04PM +0200, Matthias Fuchs wrote:
> I tested that before. I think busybox has so if-then support so far.
> This is my test output
> 
> BusyBox v0.51pre (2001.04.11-11:38+0000) Built-in shell (lash)
> Enter 'help' for a list of built-in commands.
> 
> / # if [ 1 -eq 1]; then echo "equal" fi
> [: missing ]
> > if
> sh: ÈþÈ: No such file or directory
> >

How about the following:

/home/kraai/src/busybox $ true
/home/kraai/src/busybox $ if [ $? -eq 1 ]; then echo equal; fi
/home/kraai/src/busybox $ false
/home/kraai/src/busybox $ if [ $? -eq 1 ]; then echo equal; fi
equal
/home/kraai/src/busybox $ 

Note the space between the 1 and the ].

Matt





More information about the busybox mailing list