February 2001
Beginner to intermediate
448 pages
9h 2m
English
Official Description
Executes the list following if and, if it returns a 0 (zero) exit status, executes the list following the first then.
Syntax
if list ;then list [elif list ;then list] ... [;else list] ;fi
Options
None
Oddities
At least one command must appear between the then and the fi (it can be a : if you want it to do nothing).
Place numeric tests in (( )); place string tests in [[ ]].
Example
$ x=12 $ $ if (( x == 12 )) > then > print "equal" > else > print "not equal" > fi equal $
Read now
Unlock full access