格式:
if list1;then list;[ elif list;then list; ]…[ else list; ]fi
數(shù)值比較運(yùn)算符:
-eq | 等于 |
-ne | 不等于 |
-le | 小于等于 |
-gt | 大于 |
ge | 大于等于 |
格式:
case Word in
pattern1 )
command-list1
;;
pattern2 )
command-list2
;;
pattern3|pattern4 )
command-list3
;;
…
esac
格式:
while test-commands
do
consequent-commands
done
格式:
until test-commands
do
onsequent-commands
done
格式:
for name in word1 word2 … wordN
do
commands
done
解讀:name為變量
格式:
select name [ in words … ]
do
commands
done
省略
格式:
break n
解讀:若果沒(méi)有指定參數(shù)n,則只結(jié)束最內(nèi)層的循環(huán);如果指定了可選參數(shù)n,則跳出n層循環(huán)。n必須大于等于1。如果指定的參數(shù)n大于包圍break語(yǔ)句的循環(huán)個(gè)數(shù),則跳出所有循環(huán)語(yǔ)句。
格式:
continue n
解讀:continue的作用是:繼續(xù)執(zhí)行包裹c(diǎn)ontinue的for、while、until或select循環(huán)語(yǔ)句的下一次迭代。如果指定了參數(shù)n,則結(jié)束當(dāng)前循環(huán),再執(zhí)行包裹c(diǎn)ontinue語(yǔ)句的第n層的循環(huán)語(yǔ)句的下一次迭代。參數(shù)n必須大于等于1。只要n大于等于1,continue語(yǔ)句就返回0.
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注