如何在Bash脚本设置选项

示例:

#!/bin/bash
echo "Select no. for option"
OPTIONS="Hello Onitroad Quit"
select opt in $OPTIONS; do
if [ "$opt" = "Quit" ]; then
echo done
exit
elif [ "$opt" = "Hello" ]; then
echo Hello World
elif [ "$opt" = "Onitroad" ]; then
echo "Welcome in Onitroad"
else
clear
echo bad option
echo "Type no. 1,2 or 3 for Hello,Onitroad and Quit options respectively"
fi
done
日期:2019-08-20 17:58:20 来源:oir作者:oir