1826440 Members
4043 Online
109692 Solutions
New Discussion

Re: Expect Script

 
John Carver
Frequent Advisor

Expect Script

Is there a way to run regular shell commands from within an expect script or run an expect command from within a regular (bourne, korn, bash, etc) shell script. I know I can call on the expect script from within the regular shell script, but I would like to combine everything into one file if possible.
2 REPLIES 2
Ivan Ferreira
Honored Contributor

Re: Expect Script

Here is a sample that the expect script calls unix commands:

http://rootprompt.org/article.php3?article=5760
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Mark Fenton
Esteemed Contributor

Re: Expect Script

the exec and system commands within expect can be used to call standard UNIX programs (or other shell scripts).

For a reasonably full treatment of their syntax see "Exploring Expect" pg 207

more complex shell constructs can be enclosed within {} and passed to exec or system. You may need to experiment a little to get variable expansion working the way you want. Exec and system differ in the way they handle arguements.