美文网首页
[脚本]shell命令行菜单

[脚本]shell命令行菜单

作者: 墨韵 | 来源:发表于2022-06-23 16:35 被阅读0次
    # 保存到 fileName.sh
    # 执行 sh fileName.sh
    function menu() {
        echo
        echo "=============显示菜单============="
        echo "| 1 - menu1"
        echo "| 2 - menu2"
        echo "| 3 - menu3"
        echo "| 4 - menu4"
        echo "| q - 退出"
        echo "---------------------------------"
        printf "请选择菜单:"
        read -n 1 n
        echo
        if [[ "$n" = "1" ]]; then
            echo $n
        elif [ "$n" = "2" ]; then
            echo $n
        elif [ "$n" = "3" ]; then
            echo $n
        elif [ "$n" = "4" ]; then
            echo $n
        elif [ "$n" = "q" ]; then
            echo 退出
            return
        else
            echo "other"
        fi
        menu
    }
    menu
    
    效果图 打包上传svn

    相关文章

      网友评论

          本文标题:[脚本]shell命令行菜单

          本文链接:https://www.haomeiwen.com/subject/lhkmvrtx.html