- 论坛徽章:
- 0
|
看来差的太远了。
- [root@localhost:/test]# cat menu
- #!/bin/bash
- #name menu
- MYDATE=`date +%d/%m/%Y`
- THIS_HOST=`hostname -s`
- USER=`whoami`
- while :
- do
- tput clear
- 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
- 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 user response"
- ;;
- esac
- echo -e -n "\tHit the return key to continue"
- read DUMMY
- done
复制代码
运行结果:
- [root@localhost:/test]# ./menu
- -----------------------------------------------------------------------------
- User: root Host:localhost Date:29/03/2009
- -----------------------------------------------------------------------------
- 1: List files in current directory
- 2: Use the vi editor
- 3: See who is on the system
- H: Help screen
- Q: EXIT Menu
- -----------------------------------------------------------------------------
- Your Choice [1,2,3,H,Q] >
复制代码
[ 本帖最后由 locale 于 2009-3-29 19:41 编辑 ] |
|