加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

shell – 什么语言使用“fi”

发布时间:2020-12-15 22:31:21 所属栏目:安全 来源:网络整理
导读:看到这个脚本,我试图找出使用的语言…它几乎像C,但我注意到fi是一种关闭嵌套if的方法. function prompt () {if [ "$noprompt" ] [ "$#" = "1" ]; then if [ "$1" = "yes" ]; then echo "DEFAULT: yes" return 0 else echo "DEFAULT: no" return 1 fifiwhile
看到这个脚本,我试图找出使用的语言…它几乎像C,但我注意到fi是一种关闭嵌套if的方法.

function prompt () {
if [ "$noprompt" ] && [ "$#" = "1" ]; then
    if [ "$1" = "yes" ]; then
        echo "DEFAULT: yes"
        return 0
    else
        echo "DEFAULT: no"
        return 1
    fi
fi

while true; do
    echo "Enter "yes" or "no": "
    read response
    case $response
    in
        Y*) return 0 ;;
        y*) return 0 ;;
        N*) return 1 ;;
        n*) return 1 ;;
        *)
    esac
done
}

解决方法

这些是由Unix Shell Scripts使用的……
见 this和 this.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读