Âé·³¸÷룬°ï濴һϡ£
Ïë´´½¨Ò»¸ö¼òµ¥µÄ²Ëµ¥£º#!/bin/bash
#menu
USERNAME=`whoami`
HOSTNAME=`hostname -s`
DATE=`date +%d/%m/%Y`
while :
do
tput clear
#here documents starts here
cat <<cs
----------------------------------------------------------
User:$USERNAME Host:$HOSTNAME Date:$DATE
----------------------------------------------------------
1 : List files in current directory
2 : Use the vi editor
3 : See who is on the system
H : Help screen
Q : Exit Menu
-----------------------------------------------------------
cs
#here document finished
echo -e -n "\tYour choice[1,2,3,H,Q]:"
read CHOICE
case $CHOICE in
1) ls ;;
2) vi ;;
3) who ;;
h|H) cat <<cs
This is the help screen,nothing here yet to help you!
cs ;;
q|Q) exit 0 ;;
*) echo -e "\t\007unkown user response" ;;
esac
echo -e -n "\tHit the return key to continue"
done
µ«ÔËÐÐʱ»á±¨´í£º
/root/bin/menu: line 36: syntax error: unexpected end of file
°ï濴һϣ¬ÎÊÌâ³öÔÚÄÄÀлÁË£¡ ÄÇÈý¸ö±íÇé·ûºÅÊÇ £º$ [code]
#!/bin/bash
#menu
USERNAME=`whoami`
HOSTNAME=`hostname -s`
DATE=`date +%d/%m/%Y`
while :
do
tput clear
#here documents starts here
cat <<cs
----------------------------------------------------------
User $USERNAME Host $HOSTNAME Date $DATE
----------------------------------------------------------
1 : List files in current directory
2 : Use the vi editor
3 : See who is on the system
H : Help screen
Q : Exit Menu
-----------------------------------------------------------
cs
#here document finished
echo -e -n "\tYour choice[1,2,3,H,Q]:"
read CHOICE
case $CHOICE in
1) ls ;;
2) vi ;;
3) who ;;
h|H) cat <<cs
This is the help screen,nothing here yet to help you!
cs
;;
q|Q) exit 0 ;;
*) echo -e "\t\007unkown user response" ;;
esac
echo -e -n "\tHit the return key to continue"
done
[/code] Â¥Ö÷¿ÉÒԲο¼Ò»ÏÂselect²Ëµ¥
[code]
#! /bin/bash
PS3="SELECT A PROGRAM TO EXECUTE
: "
select program in 'ls -F' pwd date exit
do
$program
# break
done
[/code] #!/bin/bash
#menu
USERNAME=`whoami`
HOSTNAME=`hostname -s`
DATE=`date +%d/%m/%Y`
while :
do
#clear
#here documents starts here
cat <<cs
----------------------------------------------------------
User$USERNAME Host$HOSTNAME Date$DATE
----------------------------------------------------------
1 : List files in current directory
2 : Use the vi editor
3 : See who is on the system
H : Help screen
Q : Exit Menu
-----------------------------------------------------------
cs
#here document finished
echo -e -n "\tYour choice[1,2,3,H,Q]:"
read CHOICE
case $CHOICE in
1) ls
continue;;
2) vi
continue;;
3) who
continue;;
h|H) echo " This is the help screen,nothing here yet to help you!"
continue;;
q|Q) exit 0
;;
*) echo -e "\t\007unkown user response" break;;
esac
echo -e -n "\tHit the return key to continue"
done
ÊÇwhileÑ»·µÄÎÊÌâ ¼ÓÉÏcontinue¾ÍÁË
µ«×îºÃ±ð¼Óclear ·ñÔòÔÚÏÔʾ֮ǰ¾ÍÍ˳öÁË ºÇºÇ£¬Ð»ÁË£¡ ºÃÏñÓÖ¿´¼ûÁ½¸öÐÂÃæ¿×, »¶Óµ½ shell °æÀ´×ö¿Í :)
To Â¥Ö÷: [color=red]ÒÔºó·¢ÌùÇëÍ»³öÖ÷Ìâ[/color] ÖµµÃѧϰ£¡Ñ§Ï°£¡Ñ§Ï°£¡
Ò³:
[1]