Chinaunix首页 | 论坛 | 博客
  • 博客访问: 92094
  • 博文数量: 23
  • 博客积分: 1485
  • 博客等级: 上尉
  • 技术积分: 245
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-31 11:41
文章分类
文章存档

2010年(23)

我的朋友

分类: LINUX

2010-06-06 16:05:07

           

自己写一个小程序

System  manage

************************

1.       show  the  user

2.       test  the network

3.       show the PID

4.       kill the process

5.       shutdown the system

6.       reboot the system

0.        exit

************************

Please type in the optin:_

 

 

(tput cap 上下距离行距/)

答案:

#!/bin/bash

clear

tput cup 2 28(两行/28个子)

echo "System Manage"

tput cup 3 24

echo "******************"

tput cup 4 24

echo "1.show the user"

tput cup 5 24

echo "2.test the network"

tput cup 6 24

echo "3.show the PID"

tput cup 7 24

echo "4.kill the process"

tput cup 8 24

echo "5.shutdown the system"

tput cup 9 24

echo "6.reboot the system"

tput cup 10 24

echo "0.exit"

tput cup 11 24

echo "******************"

tput cup 12 24

echo -n "Please type in the option:"

read AA

case $AA in

1)w

;;

2)tput cup 13 24

echo -n "please type in the IP:"

read BB

if ping -c1 $BB >/dev/null 2>&1

then

tput cup 14 24

echo "chenggong"

else

tput cup 14 24

echo "shibai"

fi

;;

3)tput cup 13 24

echo -n "Please type in the terminal ID:"

read CC

ps -t $CC

;;

4)tput cup 13 24

echo -n "please type in the PID:"

read DD

kill -9  $DD

;;

5)init 0

;;

6)init 6

;;

0)exit

;;

*)tput cup 13 24

echo -n "input error,please retry!"

;;

esac

read AAA

阅读(1800) | 评论(0) | 转发(0) |
0

上一篇:备份

下一篇:禁止root远程登录更改ssh端口

给主人留下些什么吧!~~