if statement
Ray Parrish
crp at cmc.net
Thu Aug 20 20:28:08 UTC 2009
PleegWat wrote:
> 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
>
Your method makes sense to me, and I have adopted your code as the
current form for my project's usage.
Thank you for the help, Ray Parrish
--
The Future of Technology.
http://www.rayslinks.com/The%20Future%20of%20Technology.html
Ray's Links, a variety of links to usefull things, and articles by Ray.
http://www.rayslinks.com
Writings of "The" Schizophrenic, what it's like to be a schizo, and other
things, including my poetry.
http://www.writingsoftheschizophrenic.com
More information about the ubuntu-users
mailing list