LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Trouble calling 'expect' from bash (https://www.linuxquestions.org/questions/linux-software-2/trouble-calling-expect-from-bash-450705/)

raypen 06-01-2006 05:47 PM

Trouble calling 'expect' from bash
 
I have written a small expect script which I want to call from
another bash script. I have set up the bash script to call the
expect script like this:
#! /bin/bash
..
..
. /usr/local/bin/expect-script
..
..

Unfortunately, I keep getting the error message:

"spawn: command not found, couldn't read file "Password:" " etc.

The expect script works perfectly when initiated from the
command line, so somehow trying to call it from a bash script
is causing a problem. I suspect that the initiating line
#! /usr/bin/expect in the expect script is not being executed
properly to call the expect program.

I have tried to include the expect statements in the bash script but
get the same or similar message. I somehow need to invoke 'expect'
and input these commands from bash.

Is there a way to do this?

raypen 06-01-2006 08:05 PM

I see the mistake; shouldn't have called the expect as source.

Works fine.


All times are GMT -5. The time now is 05:07 PM.