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
shell的select脚本的简单入门
原文地址:https://www.cnblogs.com/gyfluck/p/9765495.html
时间: 2024-09-28 02:50:25