#!/bin/bash
echo "please choose your profession?"
PS3="please choose the number : "
function a(){
echo "this is funciton a"
}
function b(){
echo "this is function b"
}
n=0
select var in "worker" "dock" "teacher"
do
case $var in
worker)
a
;;
dock)
b
;;
*)
esac
echo "the choose num is \$REPLY is $REPLY"
echo "your preofession is $var"
let n++
if [ $n -gt 2 ]
then
break
fi
done
SHELL菜单select练习
原文:http://blog.51cto.com/19941018/2067334