命令read

测试test.sh

#!/bin/bash

read -p "Please input number:" num

if [ "$num" -eq "1" ]; then

        echo -e "\033[32mYou enter the number is 1\033[0m"

elif [ "$num" -eq "2" ];then

         echo -e "\033[33mYou enter the number is 2\033[0m"

        elif [ "$num" -eq "3" ];then

         echo -e "\033[31mYou enter the number is 3\033[0m"

        elif [ "$num" -eq "4" ];then

        echo -e "\033[34mYou enter the number is 4\033[0m"

fi

shell 中键盘输入


转载于:https://blog.51cto.com/520and519/1558360

相关文章:

  • 2021-05-01
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2022-03-02
  • 2021-12-13
猜你喜欢
  • 2021-11-12
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-05-18
  • 2022-12-23
  • 2021-12-09
相关资源
相似解决方案