SHELL中的if条件分之:

2019-10-11  本文已影响0人  汤姆森森

单分支:

            if CONDITION; then

                if-true

            fi

        双分支:

            if CONDITION; then

                if-true

            else

                if-false

            fi

        多分支:

            if CONDITION1; then

                if-true

            elif CONDITION2; then

                if-ture

            elif CONDITION3; then

                if-ture

            ...

            else

                all-false

            fi

            逐条件进行判断,第一次遇为“真”条件时,执行其分支,而后结束;

      判断条件 CONDITION 和then不在一行的话,不用写";"

上一篇 下一篇

猜你喜欢

热点阅读