shell 导出交换机配置脚本

!/bin/bash

for devicename in ${DEVICENAME[@]}
do
echo "data +%H:%M:%S 开始备份$devicename"
IPADDR=(cat /home/Network_Config_Backup/usr.password | grep "$devicename" |awk ‘{print $3}‘)
USERNASME=(cat /home/Network_Config_Backup/usr.password | grep "$devicename" |awk ‘{print $4}‘)
PASSWORD=(cat /home/Network_Config_Backup/usr.password | grep "$devicename" |awk ‘{print $5}‘)
TABLE=(cat /home/Network_Config_Backup/usr.password | grep "$devicename" |awk ‘{print $2}‘)

if [ $TABLE = cisco ]
then
/usr/bin/expect >> /dev/null <<EOF
set timeout 10
spawn telnet $IPADDR
expect "username:"
send "$USERNASME\r"
expect "password:"
send "$PASSWORD\r"
expect {
">" {
send "enable\r"
expect "password"
send "$PASSWORD\r"
expect "*#"

shell 导出交换机配置脚本

上一篇:『论文笔记』SuperGlue


下一篇:linux:vim