08-17-07 06:19 AM
In article <1187285531.047811.49720@a39g2000hsc.googlegroups.com>,
cozzmo1@hotmail.com wrote:
> This expect script is to display the config file of a device.
> I left some lines out for brevity.
> The problem I am having with the below script, is that the output of
> "get config" has multiple "exit" statements.
> so the program exits when it hits the first one.
> I am not very advanced, so please keep it simple for me.
I don't see where you're exiting when you hit ANY "exit" statement.
Your script sends "exit", it doesn't expect it. Was that part of the
stuff you left out for brevity?
>
> Is there a way I can ignore the exit statements in the devices output?
>
> --------
> #!/usr/local/bin/expect -f
> send_user "\n"
> set force_conservative 0 ;# set to 1 to force conservative mode even
> if
> ;# script wasn't run conservatively
> originally
>
> spawn bash
> match_max 100000
>
> ##ssh to the device
> expect -exact "\$ "
> send -- "telnet $hostname\r"
> ##
> expect -exact "\>"
> send -- "get config\r"
> expect -exact "\>"
> send -- "exit\r"
> expect eof
> ---------
>
> Thanks,
> Crzzy1
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
[ Post a follow-up to this message ]
|