分享
 
 
 

一个很不错的sell菜单

王朝other·作者佚名  2008-05-19
窄屏简体版  字體: |||超大  

代码:

#Program: mmenu - shell script of user menu items

#Description:

#

Program consisting of a series of functions providing user menus

#

for simple tasks.

#

#

Functions are loaded into memory and available for execution. Once

#

loaded, the main menu will be invoked. The main menu (entry point) is :MainMenu.

#

#

The following functions are declared:

#

MainMenu

#

EditFile

#

MailMenu

#

UserUtilMenu

#

FileDirUtilMenu

#

GetFileName

#

ExecuteCommand

#

#

Last updated on 10/10/2002 by A.M. Foster

#************************************************************8

#Screen Display Variables

REV=`tput rev`

OREV=`tput sgr0`

BLD=`tput smso`

OBLD=`tput rmso`

#Various variables

MenuMsg=""

MenuChoice=""

#*********************************************************************8

#Routine: MainMenu

#Main Menu function which displays the main menu to stdout.

MainMenu()

{

#Menu loop

while true

do

tput clear

MenuChoice=""

#Main Menu - display the main menu

echo ""

echo ""

echo "

${REV}Main Menu${OREV}"

echo ""

echo ""

echo "

1.

${BLD}E${OBLD}dit / File "

echo ""

echo "

2.

${BLD}S${OBLD}end/Receive Mail ..."

echo ""

echo "

3.

${BLD}U${OBLD}ser Utilities ..."

echo ""

echo "

4.

${BLD}F${OBLD}ile Directory Utilities ..."

echo ""

echo "

0.

${BLD}L${OBLD}og Off System"

echo ""

echo ""

echo "${BLD}${MenuMsg}${OBLD}"

echo ""

echo ""

echo -n "${BLD}Select: ${OBLD}"

MenuMsg=""

#Get user's choice and evaluate with case statement

read MenuChoice

#get user selection

case ${MenuChoice} in

"1" | "e" | "E" )

EditFile

;;

"2" | "s" | "S" )

MailMenu

;;

"3" | "u" | "U" )

UserUtilMenu

;;

"4" | "f" | "F" )

FileDirUtilMenu

;;

"0" | "l" | "L" )

echo " "

echo " "

echo "Exiting per User request!"

sleep 2

tput clear

exit 1

;;

* )

MenuChoice=""

MenuMsg="${BLD}Invalid choice. Please try again.${OBLD}"

;;

#Example of menu command that is hidden from users. Note that

#it is not in the menu, but has a choice in the case statement.

"admin" )

ExecuteCommand 'ps -ef | more'

;;

esac #end of case statement

done #end of menu loop

}

#************************************************************************************

#Routine EditFile

#Presents the Edit File Menu to stdout

EditFile()

{

MenuMsg=""

while true

do

MenuChoice=""

tput clear

echo ""

echo ""

echo "${REV}EDIT FILE${OREV}"

echo ""

echo ""

echo "1.

${BLD}E${OBLD}nter File Name "

echo ""

echo "2.

Enter File Name Name from Li${BLD}s${OBLD}t ... "

echo ""

echo "0.

${BLD}M${OBLD}ain Menu "

echo ""

echo ""

echo "${BLD}${MenuMsg}${OBLD}"

echo ""

echo ""

echo -n "${BLD}Select: ${OBLD}"

MenuMsg=""

#Get user's choice and evaluate with case statement

read MenuChoice

#get user selection

case ${MenuChoice} in

"1" | "e" | "E" )

echo -n "Enter file name to edit: "

read FileName

if [ -z "${FileName}" ] #check if user provided a file name

then

MenuMsg="You did not enter a valid file name!"

else

if [ -f ${FileName} ] #check if file exists

then

#check if file is a text file

if [ "file ${FileName} | grep text /dev/null" ]

then

filesoktoedit="y"

else

MenuMsg="${FileName} - is not an editable file!"

fi

else

filesoktoedit="y"

fi

fi

if [ $}filesoktoedit}="y" ]

then

vi "${FileName}"

echo " "

echo " Press any key to continue.."

fi

;;

"2" | "s" | "S" )

FileName=""

GetFileName FileName

if [ $? -eq 0 ]

then

if [ "file ${FileName} | grep text /dev/null" ]

then

vi "${FileName}"

echo " "

echo " Press any key to continue.."

else

MenuMsg="${BLD}${FileName} - is not an editable file!${OBLD}1"

fi

fi

;;

"0" | "m" | "M" )

break

;;

* )

MenuChoice=""

MenuMsg="${BLD}Invalid Choice! Please try again.${OBLD}"

;;

esac

done

return 0

} #end of EditFile function

#**********************************************************************************

#Routine MailMenu

#Displays Mail Menu to stdout

MailMenu()

{

MessageMenu=""

while true

do

tput clear

MenuChoice=""

echo ""

echo ""

echo "${REV}MAIL MENU${OREV}"

echo ""

echo ""

echo "

1.

${BLD}S${OBLD}end Mail"

echo ""

echo "

2.

${BLD}R${OBLD}eceive Mail"

echo ""

echo "

0.

${BLD}M${OBLD}ain Menu"

echo ""

echo "${BLD}${MenuMsg}${OBLD}"

echo ""

echo ""

echo -n "${BLD}Select: ${OBLD}"

MenuMsg=""

#Get user's choice and evaluate with case statement

read MenuChoice

#get user selection

case ${MenuChoice} in

"1" | "s" | "S" )

echo " "

echo -n "Enter a mail ID to send to: "

read mailid

if [ -z "${mailid}" ]

then

MenuMsg="You mus

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有