读取用户输入并判断的bash脚本

#!/bin/bash

echo -e "1) A"
echo -e "2) B"
echo -e "3) C"
echo -e "4) D"
echo -e "5) E"
echo -e "6) F"
echo -e "7) G"
echo -e "8) H"
echo -e "9) I"
echo -e "-- Press any other key to quit--"

echo -e "Enter the number you want to access?\n"
read -n1 answer
case $answer in
1)
command 1;;
2)
command 2;;
3)
......
*)
esac
exit 0

posted @ 2018-07-02 16:41  Mrcoool  阅读(396)  评论(0编辑  收藏  举报