水果菜单脚本fruit.sh
#!/bin/bash
RED_COLOR='\E[1;31m'
GREEN_COLOR='\E[1;32m'
YELLOW_COLOR='\E[1;33m'
BLUE_COLOR='\E[1;34m'
PINK='\E[1;35m'
RES='\E[0m'
menu(){
cat <<END
==========================
1.apple
2.pear
3.banana
4.exit
==========================
END
}
while true
do
menu
read -p "please inut your choice:" fruit
case "$fruit" in
1)
echo -e "$RED_COLOR apple $RES"
;;
2)
echo -e "$GREEN_COLOR pear $RES "
;;
3)
echo -e "$YELLOW_COLOR banana $RES"
;;
4)
exit 0
;;
*)
echo -e "no fruit you choose"
;;
esac
done
测试
sh fruit.sh