Pages - Menu

友站連結

2010/01/19

透過批次指令下操作Switch

##switch operation, switch.sh
#!/bin/bash


function sys_open {


echo open 172.20.15.250
#Connect Switch
sleep 0.1
echo CIMswit
#input password
sleep 0.1
echo en
#
進入enable模式

sleep 0.1
echo CIMswit
#input password
sleep 0.1
echo "terminal length 0"
#不要有翻頁,一次顯示完
sleep 0.1

echo "show int status"
#show interface
狀態
echo""
sleep 0.1


}


sys_open | telnet | grep disabled | awk '{print $1}'>aa.txt
#
呼叫函數,並導到一個檔案中


 


參考檔案,裡頭還有判斷式:


http://portable.easylife.tw/1303?category=3


 


沒有留言:

張貼留言