?? reset_right.sh
字號:
#!/bin/bash
###判斷是否帶有參數
if [ '$1'=='];
then
echo –e '\33[om reboot.sh filename \n filename if a file which cantain thi ip list you want to reboot .\n]';
exit;
fi
###顯示提示信息并讀取passwd
echo –e '\33 [lm\33[5mwarning : \33 [om this script will reboot following gameserver 'more 41'
if you confire to do this ,please input the server password. Otherwise, press ^c to abort the script .'
read –p $USER@server password: -s passwd
echo –e "\n"
###讀入IP地址給變量host,用expect控制登錄過程
for host in 'more $1 | grep '^[1-9]''
do
expect –c '
set timeout 30;
spawn /usr/bin/ssh $host ls –1;
expect {
\'*yes/no*'{send \'yes\r';
exp_continue }
\'*password*\'{send \'$passwd\r\';}
expect eof ;'
done
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -