select常用于选择菜单的创建。
vim 16select.sh
#!/bin/bash
#打印LAMP选择菜单
#PS3是select提示符
PS3="please enter you select install menu:"
select i in http php mysql quit
do
case $i in
http)
echo "http is installing..."
;;
php)
echo "php is installing..."
;;
mysql)
echo "mysql is installing..."
;;
quit)
exit
;;
*)
echo "error!"
esac
done
执行: