if statement
Michael Welle
mwe012008 at gmx.net
Thu Aug 20 16:45:04 UTC 2009
Hi,
Ray Parrish <crp at cmc.net> writes:
> Hello,
>
> I am having difficulty with an if statement. Here it is -
>
> # load the sleep interval in seconds from the command line.
> interval=$2;
> # if specified interval in seconds is less than 200 or empty, set it
> to the default of 300 seconds
> if [ $interval == "" ]
>
> then
> interval=300; # five minutes default setting
> echo "interval blank";
> fi
[...]
> This happens with a single "=" as well. What am I doing wrong here?
wrong ml.
Use [ "x${interval}x" = "xx" ] for comparing the value of the variable
with a string.
Regards
hmw
--
biff4emacsen - A biff-like tool for (X)Emacs
http://www.c0t0d0s0.de/biff4emacsen/biff4emacsen.html
Flood - Your friendly network packet generator
http://www.c0t0d0s0.de/flood/flood.html
More information about the ubuntu-users
mailing list