Hi,
I'm trying to use expect to get data from telnet
Here's my code :
Code:
set equipment [lindex $argv 0]
set trunk [lindex $argv 1]
set fraction [lindex $argv 2]
set user1 "rnanaha8"
set pass1 "anggur#1"
set user2 "rzulkif8"
set pass2 "Abyan_2011"
spawn ssh rnanaha8@10.2.81.116
expect "*word*" { send "$pass1\r" }
expect "*$user1*" { send "telnet 10.105.224.68\r" }
expect "*ogin*" { send "$user2\r" }
expect "*asswor*" { send "$pass2\r" }
expect "*ANCB*" { send "gsh get_e1t1_frac -eq {$equipment} -trunk $trunk -frac $fraction\r" }
expect "*ANCB*" { send "exit\r" }
expect "*$user1*" { send "exit\r" }
expect eof
but this get error
Build label: NDPGSN_5_0_SRC_GSN_LINUX_4R1D01
Build host: selnx056
Build date: Thu Feb 19 20:50:48 MET 2009
Installed: Sat Dec 19 11:32:38 UTC 2009
=== rzulkif8@eqm01s13p2 ANCB ~ # gsh get_e1t1_frac -eq {2 6 1 1
Missing }.
=== rzulkif8@eqm01s13p2 ANCB ~ # } -trunk 3
}: Command not found.
=== rzulkif8@eqm01s13p2 ANCB ~ # -frac 16
-frac: Command not found.
=== rzulkif8@eqm01s13p2 ANCB ~ #
=== rzulkif8@eqm01s13p2 ANCB ~ # exit
logout
================================================
so in bold letter not send in 1 line, but i want sent it to 1 line
thank's for your suggestion