用shell脚本编写有以下的功能:
Syste Manage
1.show the user //显示登陆系统用户以及动作。
2.test the network //网络测试
3.show the TID //显示进程信息
4.kill the peocess //杀死进程
5.shoutdown the system //关机
6. reboot the system //重启
0.ecit //退出程序
#(linux菜单式程序)
source code:
#! /bin/bash
#sh yan
while true
do
clear
tput cup 2 24
echo -n "system Manage"
tput cup 3 24
echo -n "*****************"
tput cup 4 24
echo -n "1.show the user"
tput cup 5 24
echo -n "2.tset the network"
tput cup 6 24
echo -n "3.show the PID"
tput cup 7 24
echo -n "4.kill the process"
tput cup 8 24
echo -n "5.shoutdown the system"
tput cup 9 24
echo -n "6.reboot the system"
tput cup 10 24
echo -n "0.exit"
tput cup 11 24
echo -n "*******************"
tput cup 12 24
echo -n "Please type in the option[0-6]:"
read AA
case $AA in
1) w
;;
2)tput cup 13 24
echo -n "qing shu ru ni yao ping de IP:"
read BB
(ping -c1 $BB >/dev/null 2>&1) && (tput cup 14 24;echo "OK!")||(tput cup 14 24;echo "Fail!")
;;
3)tput cup 13 24
echo -n "please type in the TID:"
read CC
ps -t $CC
;;
4)tput cup 13 24
echo -n "qing shu ru jing cheng hao :"
read DD
kill -9 $DD
;;
5)init 0
;;
6)init 6
;;
0)exit
;;
*)echo "cuo wu!"
;;
esac
read QQ
done
菜单式程序编写思路:
1)使用"tput cup"和"echo"命令,显示菜单。
2)调用case语句实现菜单各向功能。
3)使用“无条件循环”,使程序在每项功能实现后,返回主菜单。
4)在指定的位置(esac和done之间)加上read 变量 起停顿作用。
The authenticity of host '64.71.167.20 (64.71.167.20)' can't be established.
RSA key fingerprint is bf:fd:e4:52:fe:25:9c:72:f5:1f:49:77:cf:3b:85:79.
Are you sure you want to continue connecting (yes/no)?
ssh 连接时经常能碰到如上信息,如果一两台还可以手动输入,如果多了就麻烦
可以在/etc/ssh/ssh_config 中添加StrictHostKeyChecking no 就可以了
阅读(3710) | 评论(0) | 转发(4) |