zoukankan      html  css  js  c++  java
  • Shell菜单脚本

    今天在这儿给大家分享一个我简单编写的Shell菜单脚本,傻瓜式的人机交互,人人都可以操作linux。

    #!/bin/sh
    #Shell菜单演示
    function menu ()
    {
        cat << EOF
    ----------------------------------------
    |***************菜单主页***************|
    ----------------------------------------
    `echo -e "33[35m 1)电子设备33[0m"`
    `echo -e "33[35m 2)车辆信息33[0m"`
    `echo -e "33[35m 3)主菜单33[0m"`
    `echo -e "33[35m 4)退出33[0m"`
    EOF
    read -p "请输入对应产品的数字:" num1
    case $num1 in
        1)
          echo "Welcome to ELE主页!!"
          eleproduct_menu
          ;;
        2)
          echo "Welcome to CAR主页!!"
          car_menu
          ;;
        3)
          clear
          menu
          ;;
        4)
          exit 0
    esac
    }
    
    function eleproduct_menu ()
    {
        cat << EOF
    ----------------------------------------
    |***************ELE主页****************|
    ----------------------------------------
    `echo -e "33[35m 1)苹果33[0m"`
    `echo -e "33[35m 2)魅族33[0m"`
    `echo -e "33[35m 3)小米33[0m"`
    `echo -e "33[35m 4)返回主菜单33[0m"`
    EOF
    read -p "请输入对应产品的数字:" num2
    case $num2 in
        1)
          echo "the is iphone X ¥8888!!"
          eleproduct_menu
          ;;
        2)
          echo "the is meizu pro6 ¥2600!!"
          eleproduct_menu
          ;;
        3)
          echo "the is xiaomi MXA2 ¥4290!!"
          eleproduct_menu
          ;;
        4)
          clear
          menu
          ;;
        *)
          echo "the is fail!!"
          eleproduct_menu
    esac
    }
    
    function car_menu ()
    {
        cat << EOF
    ----------------------------------------
    |***************CAR主页****************|
    ----------------------------------------
    `echo -e "33[35m 1)大众33[0m"`
    `echo -e "33[35m 2)宝马33[0m"`
    `echo -e "33[35m 3)梅赛德斯奔驰33[0m"`
    `echo -e "33[35m 4)返回主菜单33[0m"`
    EOF
    read -p "请输入对应产品的数字:" num3
    case $num3 in
        1)
          echo "the is dazon ¥120000!!"
          car_menu
          ;;
        2)
          echo "the is BMW ¥230000!!"
          car_menu
          ;;
        3)
          echo "the is bench ¥460000!!"
          car_menu
          ;;
        4)
          clear
          menu
          ;;
        *)
          echo "the is fail!!"
          car_menu
    esac
    }
    menu
    Just Do It
  • 相关阅读:
    在蓝鲸标准运维上进行原子开发二
    python 使用eval报错NameError: name ‘null’ is not defined
    前端时间转换 2019-08-18T16:00:00.000Z 转换成格式2019-08-18
    python list排序
    Django 分页Paginator的简单用法
    蓝鲸ESB自定义组件的部署步骤
    Unity对象池的实现
    Unity3D UGUI实现Toast
    C#中扩展方法的使用
    Unity3D实现多语言切换
  • 原文地址:https://www.cnblogs.com/JeremyWYL/p/7560156.html
Copyright © 2011-2022 走看看