put cisco conf in file

shconf.sh:

#!/usr/local/bin/expect -f
set timeout 30
spawn telnet [lindex $argv 0]
match_max 100000000
expect ogin {send login\r}
sleep 1
expect assword {send pass\r}
sleep 1
expect “>”
send “terminal length 0\r”
sleep 3
expect “>”
send “show configuration\r”
sleep 1
expect “>”
set fid [open [lindex $argv 0].log w+];
set tempvar1 $expect_out(buffer);
puts “this is tempvar \n $tempvar1”;
puts $fid $tempvar1 ;
expect eof

./shconf.sh cisco_1

telnet cisco login

sh_int.sh:

#!/usr/local/bin/expect -f

spawn telnet [lindex $argv 0]
expect ogin {send login\r}
sleep 1
expect assword {send password\r}
sleep 1
send “terminal length 0\r”

#if juniper

#send “set cli screen-length 0\r”

send “show interface [lindex $argv 1]\r”

send “exit\r”
expect eof


./sh_int.sh cisco_1 gi1/1.5