The if statement
- format
# A single limb IF [condition determination]; the then perform an action Fi IF [condition determination]; the then performing an action else performing an action Fi # multibranched IF [condition determination]; the then perform an action elif [conditional]; the then perform an action elif [Condition Analyzing]; the then perform an action fi
- example
. 1 ! # / Bin / the bash 2 Digital # determines whether the input is greater than 10 . 3 echo ' Please enter a number: ' . 4 Read Number . 5 . 6 IF [$ Number -eq 10 ]; . 7 the then . 8 echo ' equal to 10 ' . 9 elif [ Number -LT-$ 10 ] 10 the then . 11 echo " less than 10 " 12 is elif [$ -gt Number 10 ] 13 is the then 14 echo ' greater than 10 ' 15 be