can expect be called from within a bash script?
Hi.
As a general question, can you run expect commands from within a bash script? In the middle of a bash script is it possible to stick in a few expect commands to do some automated interaction and then carry on in bash? Or is this wishful thinking? Thanks. |
As it runs under bash, that makes perfect sense ...
|
My experience with expect is limited and ancient, but yes, you can do this. The easiest way, IMO, is to use expect scripts. The man page discusses how the first line of an expect script could look:
Code:
-- may be used to delimit the end of the options. This is Hope this helps. |
ok, that sounds good.
Wanted to know to see whether I should learn it. So I can just whack in an expect block of commands like so: Code:
#!/bin/bash Thanks for your help. |
You can probably mix but it will get unreadable.
In bash you can call your script like this: /path/to/blah/myexpectscript $var1 $var2 then in myexpectscript: #!/usr/bin/expect -f set var1 [lindex $argv 1] puts "var1=$var1" |
All times are GMT -5. The time now is 07:17 AM. |