如何在Bash脚本设置选项
时间:2019-08-20 17:58:20 来源:igfitidea点击:
示例:
#!/bin/bash echo "Select no. for option" OPTIONS="Hello theitroad Quit" select opt in $OPTIONS; do if [ "$opt" = "Quit" ]; then echo done exit elif [ "$opt" = "Hello" ]; then echo Hello World elif [ "$opt" = "theitroad" ]; then echo "Welcome in theitroad" else clear echo bad option echo "Type no. 1,2 or 3 for Hello,theitroad and Quit options respectively" fi done