这个shell script是用来操作我的邮服帐号的,现在提供了查看,删除,修改,更新等基本功能。还没有最终完成,比如在部分出错处理时,采用简单忽略的处理方式,数据库的备份和恢复也没加进去呢,删除帐号时也没有提供是否要删除邮件内容的的选择,现在是不删,测试嘛,省的删了又建,麻烦,嘻嘻!有时间再来改吧!真要酬谢我的兄弟p4s2wd啊,前些日子,他发了个在线音乐的网址给我,让我听某个电台,我的firefox无法正常显示,我生气就换成win2000了,我的shell稿子,就这么一生气忘了备份了,呵呵呵,装完系统,补丁更新完毕,重启,啊,win2000起不来了,我晕倒!算了,还是换回来吧!于是又用debian sarge做桌面!这时候才想起来,我的那个脚本没有备份!还好我运气虽然差,还没差到家,呵呵,我记得给我兄弟p4s2wd发过一次,请他斧正的,于是让他又发回给我!他没删噢!哈哈

#!/bin/sh#menu#Main Menu Script#set -x#ignore CTRL-C and QUIT interruptstrap "" 2 3 15MYDATE=`date +%d/%m/%Y`THIS_HOST=`hostname -s`USER=`whoami`#User level fileUSER_LEVELS=priv.user#hold fileHOLD1=hold1.$$#select1_result fileSELECT1_RESULT=select1_result.$$#seleclt_op fileSELECT1_OP=select1_op.$$#Colour functioncolour(){#format is background;foregroundmcase $1 inblack_green)echo "";;black_yellow)echo "";;black_white)echo "";;black_cyan)echo "";;red_yellow)echo "";;esac}#Just read a single key please#get_char()#{#get_char#Save current stty settings#SAVEDSTTY=`stty -g`#stty cbreak#dd if=/dev/tty bs=1 count=1 2> /dev/null#stty -cbreak#stty $SAVEDSTTY#}#Turn the cursor on or offcursor(){#cursor#turn cursor on/off_OPT=$1case $_OPT inon) echo "[?25h";;off) echo "[?25l";;*) return 1;;esac}#check what privilege level the user hasrestrict(){colour red_yellowecho -e -n " 07Sorry you are not authorised to use this function"colour black_green}user_level(){#user_level#read in the priv.user filewhile read LINEdo case $LINE in#ignore comments#*);;*)echo $LINE >> $HOLD1;;esacdone < $USER_LEVELSFOUND=falsewhile read MENU_USER PRIVdoif [ "$MENU_USER" = "$USER" ]thenFOUND=truecase $PRIV inyes|YES)return 0;;no|NO)return 1;;esacelse#no match found read next recordcontinuefidone <$HOLD1if [ "$FOUND" = "false" ]thenecho "Soryy $User you have not been authorised to use this menu"exit 1fi}#called when user selects quitmy_exit(){#my_exit#called when user selects quit!colour black_whitecursor onrm *.$$exit 0}tput init#display their user levels on the screenif user_level; thenACCESS="Access Mode is High"elseACCESS="Access Mode is Normal"fimy_select1(){clearcolour black_greencat <

03-14 23:32