- 论坛徽章:
- 0
|
找BUG?看你能找出几个?
the correct code
- #!/bin/sh
- #menu
- #set the date,user and hostname up
- MYDATE=`date +%d/%m/%Y`
- THIS_HOST=`hostname -s`
- USER=`whoami`
- #loop
- while :
- do
- #clear the screen
- tput clear
- #here doc
- cat <<MAYDAY
- --------------------------------------------------------------
- User:$USER Host:$THIS_HOST Date:$MYDATE
- --------------------------------------------------------------
- 1:list files in current directory
- 2:Use the vi editor
- 3:See who is on the system
- H:Help screen
- Q:Exit Menu
- --------------------------------------------------------------
- MAYDAY
- #here doc finish
- echo -e -n "\tYour choice[1,2,3,H,Q]>"
- read CHOICE
- case $CHOICE in
- 1) ls
- ;;
- 2) vi
- ;;
- 3) who
- ;;
- H|h)
- cat <<MAYDAY
- This is the help screen,nothing here yet to help you!
- MAYDAY
- ;;
- Q|q) exit 0
- ;;
- *) echo -e "\t\007Unknown flag"
- ;;
- esac
- echo -e -n "\007Hit the return key to continue"
- read DUMMY
- done
复制代码 |
|