格式:
select 变量名 in 列表
do
break
done
程序:
#!/bin/bash
echo "What would you want:"
select var in "I" "LOVE" "YOU"
do
break;
done
printf "choose:%s/n" $var
运行结果:
正常选择:
超范围选择:
结论:select语句没有默认处理。若超范围选择,放回空字符。
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/183260.html