Subject: Re: expect a how to - DN [1]
claird@starbase.neosoft.com (Cameron Laird) - 12 Aug 1999 - comp.lang.tcl
In article <37B29D92.91F550AE@eei.ericsson.se>,
Gareth Gunning <eeiggug@eei.ericsson.se> wrote:
>Thanks for both these response, but I an having a problem getting the uname result
.
[various confusions
and false starts]
.
.
#!/usr/local/bin/expect
# ... (Set host, user($host), ... here.)
# Typical values for prompt($host): "> "; "# "; "$host: "; ...
log_user 0
set command "uname -a"
spawn telnet $host
expect "login: "
send -- "$user($host)\r"
expect "Password:"
send -- "$pass($host)\r"
expect $prompt($host)
send -- "$command\r"
expect $prompt($host)
set result expect_out(buffer)
send -- "exit\r"
# You'll want to strip out $command, $prompt($host), and so on.
puts "The result you're after is something like '$expect_out(buffer)'."
Expect's [interact] is a wonderful thing. It was just a
distraction for what I understand to be your goal with this
problem, though.
When in doubt, remember: autoexpect is your friend.
--
Cameron Laird http://starbase.neosoft.com/~claird/home.html
claird@NeoSoft.com +1 281 996 8546 FAX
Last modified
1999-09-27
1999-09-27
(195.108.246.50)
Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated
