在server0上穿件一个名为/root/script.sh的脚本,让其提供给下列的特性
1.当运行/root/script.sh all,输出为none
2.当运行/root/script.sh none,输出为all
3.当没有任何参数或者参数不是all或者none时,其错误的输出产生一下信息/root/script.sh all | none
1 #!/bin/bash 2 while : 3 do 4 read -p "请输入参数(all/none),不输入则退出" A 5 if [ -z "$A" ];then 6 echo "退出脚本" 7 break 8 else 9 case $A in 10 none) 11 echo "all";; 12 all) 13 echo "none";; 14 *) 15 echo "请输入正确的参数:all|none";; 16 esac 17 fi 18 done