expect - problem split argv 0, then send each item as command
- From: inetquestion <inetquestion@xxxxxxxxxxx>
- Date: Sun, 20 Apr 2008 07:23:53 -0700 (PDT)
When I execute the following script via: ./go.exp
"date;hostname;uname"
I only get output from the puts line, instead of actually sending the
commands to a shell. What am I missing? Is there a problem putting an
expect block inside a foreach loop?
-Inet
#!/usr/bin/expect
foreach element [ split [lindex $argv 0] ";" ] {
puts "sending: $element\n"
expect {
-re ".*$" { send -- "$element\r" }
}
}
-------
-------
../go.exp "date;hostname;uname"
sending: date
sending: hostname
sending: uname
.
- Follow-Ups:
- Prev by Date: Re: ANN Tloona 1.3.0 released
- Next by Date: Re: ANN Tloona 1.3.0 released
- Previous by thread: ANN Tloona 1.3.0 released
- Next by thread: Re: expect - problem split argv 0, then send each item as command
- Index(es):
Relevant Pages
|