【问题标题】:Bash - what's the use of "fi ;;"?Bash - “fi ;;”有什么用?
【发布时间】:2011-10-24 01:27:21
【问题描述】:

我一直在到处寻找解释。下面是一个来自 apt-fast.sh 脚本的真实示例:

if [ ! -x /usr/bin/axel ]
then echo "axel is not installed, perform this?(y/n)"
    read ops
    case $ops in
     y) if apt-get install axel -y --force-yes
           then echo "axel installed"
        else echo "unable to install the axel. you are using sudo?" ; exit
        fi ;;
     n) echo "not possible usage apt-fast" ; exit ;;
    esac
fi

"fi ;;"if 块中间有什么用?

【问题讨论】:

标签: bash if-statement


【解决方案1】:

fi 关闭if 语句,而;; 关闭case 语句中的当前条目。

【讨论】:

    【解决方案2】:

    fi 用于关闭y) case 语句中的 if 块,;; 用于结束y) 情况。

    【讨论】:

      【解决方案3】:

      fi 终止前面的if,而;; 终止case...esac 中的y)

      【讨论】:

        【解决方案4】:

        fi 关闭打开 3 行的 if 语句。 ;; 关闭由y) 打开的案例。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2017-07-10
          • 1970-01-01
          • 2016-09-10
          • 2018-01-24
          • 1970-01-01
          • 1970-01-01
          • 2014-09-07
          • 1970-01-01
          相关资源
          最近更新 更多