if test; then dosomething elif test; then doother else allright fiperl
if (c) {
do_something;
} elsif () {
do_other;
} else {
allright;
}
C
if (c) {
do_something;
} else if () {
do_other;
} else {
allright;
}
這邊要注意的是shell不需要括號,else if的寫法三個不一樣。條件式寫法,
shell沒有一定要用()包住條件式,只要test是某個可執行的敘述就好