shell的select脚本的简单入门
语法:
select var in ...;do
break;
done
echo $var
示例:
#/bin/bash echo "what is your favourite fruit?" select fruit in "Apple" "Banana" "Orange" "Grape" "Other";
do break; done echo "you have selected $fruit"
结果:
what is your favourite fruit? 1) Apple 2) Banana 3) Orange 4) Grape 5) Other #? 2 you have selected Banana