[X-Unix] A little shell scripting help

Philip J Robar pjrobar at areyoureallythatstupid.org
Mon Oct 3 14:46:15 PDT 2005


On Oct 3, 2005, at 2:14 PM, Mac Daddy wrote:

> Hello all,
>
> I've got a more complex script that failing and I've isolated it  
> down to one basic part that's in trouble. The following snippet  
> exemplifies the problem that my larger project is having.
>
> #!/bin/sh
> retry=1
> echo $retry
> retry=`expr $retry + 1`
> echo $retry
> if ($retry>1)
> then
> echo "beep"
> fi

if [ $retry > 1 ]
then
	echo "beep"
fi


The '[' is the test command, which tests your expression. The result  
of the test is then evaluated by the if. Note that the spaces after  
the '[' and before the ']' are required.

Phil



More information about the X-Unix mailing list