if statement
Ray Parrish
crp at cmc.net
Sat Aug 22 19:35:11 UTC 2009
Ulf Rompe wrote:
> Am Donnerstag, den 20.08.2009, 13:44 -0700 schrieb Ray Parrish:
>
>>>> to the default of 300 seconds
>>>> if [ $interval == "" ]
>>>>
>>>> then
>>>>
>>> Shouldn't this statement be something like :
>>>
>>> If [ $interval == "" ] ; then
>>>
>>> Aren't you missing the semi-colon here ?
>>>
>>>
>> It works fine without the semi-colon, does it need to be there for
>> some other reason?
>>
>
> You can separate statements with either linefeeds or semicolons. Thus
> this:
>
> if true
> then
> echo "it is true"
> fi
>
> is the same as this:
>
> if true; then
> echo "it is true"
> fi
>
> or even this:
>
> if true; then echo "it is true"; fi
>
> Since "then" is a required statement on its own (but looks ugly and
> doesn't deserve an own line), it is common practice to combine "if" and
> "then" on a single line, in which case you need the semicolon.
>
> [x] ul
>
Thank you for that clarification. I now understand what the semi-colon
is used for in this case.
Later, 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