Chinaunix首页 | 论坛 | 博客
  • 博客访问: 479180
  • 博文数量: 83
  • 博客积分: 2570
  • 博客等级: 少校
  • 技术积分: 901
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-19 12:05
文章分类

全部博文(83)

文章存档

2012年(1)

2011年(1)

2010年(8)

2009年(14)

2008年(45)

2007年(14)

我的朋友

分类:

2008-02-18 16:13:51

#!/bin/bash
#f_menu
xy()
{
_R=$1;
_C=$2;
tput cup $_R $_C
}
colour()
{
case $1 in
black_green)
echo -e "\033[40;32m"
;;
black_yellow)
echo -e "\033[40;33m"
;;
black_white)
echo -e "\033[40;37m"
;;
black_cyan)
echo -e "\033[40;36m"
;;
black_blue)
echo -e "\033[40;34m"
;;
esac
}
trap "" 1 2 3
mday=`date +%d/%m/%y`
mhost=`hostname`
mwho=`whoami`
while :
do
cat <      ----------------------------------------------------------------
         $mwho          $mhost          $mday
      ----------------------------------------------------------------
                1: change colour
                2: use the vi
                3: see who on the system
                H: help
                Q: quit
      ----------------------------------------------------------------
mmenu
echo -e -n "\tEnter Your Choice[1,2,3,H,Q]:"
read Cho
case $Cho in
1)
while :
do
cat <      ----------------------------------------------------------------
         $mwho          $mhost          $mday
      ----------------------------------------------------------------
        1:black_white   2:black_yellow  3:black_green
        4:black_blue    5:black_cyan    6:return pre_menu
     -----------------------------------------------------------------
kcol
echo -e -n "\t Enter Your Choice[1,2,3,4,5,6]:"
read choice
        if [ "$choice" = "1" ]
        then
        colour black_white
        elif [ "$choice" = "2" ]
        then
        colour black_yellow
        elif [ "$choice" = "3" ]
        then
        colour black_green
        elif [ "$choice" = "4" ]
        then
        colour black_blue
        elif [ "$choice" = "5" ]
        then
        colour black_cyan
        elif [ "$choice" = "6" ]
        then
        break
        else
        echo -e -n "\t\tUnknow user response\n"
        fi
clear
done
;;
2)
vi
;;
3)
who
;;
H|h)
cat <this is the help screen ,nothing here yet to help you!
mmenu
;;
Q|q)
exit 0
;;
*)
echo -e "\tUnknow user response"
;;
esac
echo -e -n "\t\tHit the return key to continue"
read J
clear
done
 
重点:使用<
.....
!
创建菜单
 
case .....esac
 
if条件
then动作
elif 条件
then动作
 else
动作
fi
 
while 条件
do
动作
done
阅读(1811) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~