if statement
PleegWat
pleegwat at telfort.nl
Thu Aug 20 19:56:23 UTC 2009
Ray Parrish wrote:
> if [ $interval == "" ]
>
> then
> interval=300; # five minutes default setting
> echo "interval blank";
> fi
If you run a test on a variable that may be empty, quote it. Often you
see a character appended to the variable and the variable being tested
against that, but I've never found that to be necessary
if [ "$interval" == "" ]
then
interval=300; # five minutes default setting
echo "interval blank"
elif [ $interval -lt 200 ]
then
interval=200; # 3 min 20 minimum setting
echo "interval increased to minimum 200 seconds"
fi
should work
PleegWat
More information about the ubuntu-users
mailing list