关于CASE的用法

关于CASE的用法

刚刚写了个简单的雇员管理系统,主要是查选工资,修改工资和退出系统。
主要是今天看了一眼函数。想利用下函数。
现在又有一些问题出来了,希望各位高手耐心的看完我的程序,然后给与指点。有问题的我用粗体标记了一下。
引用:

#!/bin/sh
#empolyee salary array, totally 10 employee’s salary
salary=(1200 1400 3600 4500 5000 6800 7800 8500 9600 10000)

# user welcome interface page
while :
do
echo "================================================"
echo "=Simple employee salary managerment sysetem                   ="
echo "=1.Display employee salary                                                 ="
echo "=2.Modify employee salary                                                 ="
echo "=3.Quit system                                                                     ="
echo "=============================================== "

#query employee salary, if employee number is less than 10,then it will give correct salary #according to employee number
Display()
{
echo -n "**please input your employee number:"
read num1
if [ $num1 -lt 10 ];then
echo "**Employee number is $num1. the salary is ${salary[$num1]}"
echo "**Welcome to continue to use management system"
else
echo "##the error emplooey number! Please re-enter number!"
fi
}

#modify employee salary, employee will query salary firstly,then modify salary.

Modify()
{
echo -n "**please input your employee number:"
read num1
if [ $num1 -lt 10 ]; then
echo "**Employee number is $num1. the salary is ${salary[$num1]} "
echo -n "**please input new salary:"
read num2
salary[$num1]=$num2                    ------现在程序能接受新的修改的值,下次查询时,修改没生效?但怎么使这 个值永久改变??
echo "the salary you input is: ${salary[$num1]} "
else
echo "##the error emplooey number!,please re-enter nubmer:"
exit 1
fi
}
#if select 3 selection, then call quit function, program will quit
Quit()
{
echo "do you really want to quit this systme?[y..n]:"
read var
case $var in
Y|y)
exit 0
;;
N|n) echo "please waiting..."
;;
*) echo "please input correct word [y or n]"
;;
esac
}
# it will prompt user to choose selection.then call corresponding function.
echo -n " Please input your choose:"
read num
case $num in
1) Display
#call display function to display employee salary
;;
2) Modify
#call modify function to modify employee salary
;;
3) Quit
#call quit fuction
exit 0
;;
*)
#if input wrong selction,systme will prompt user proper selection
echo "`basename $0` : sorry that you should input correct selection" > error.txt                 ---如果选择除1 2 3的选择,程序似乎没有执行这,如我单拿出CASE语句,就能通过。真是奇怪!
;;
esac
done
      
这么多 code, 格式还乱乱的, 谁会有耐心读完呢 建议把关键问题提炼出来      
同上
邪恶的四字节      
引用:
原帖由 snms 于 2008-11-6 17:49 发表
同上
邪恶的四字节
快别看这种青涩的程序了,昨天看了一个高手的程序,只一个字‘赞’!,不过,我也是刚学习中,
被LINUX所吸引,争取早日进阶高手队列