Spawn fatal do not run this command by hand

spawn ssh oracle@$myserver $mycommand
match_max 100000
expect "*?assword:*"
send "$v_password\r"
send "\r"
expect eof

I run this code above and got the error.

spawn: fatal: do not run this command by hand

Thanks

How did you run that code?
executing the code from a terminal and your login shell ( and so interactive ) or batch mode ( using cron or at or any other scheduler ) ?

I run it from terminal and login shell , then I put it in the script and run it as a script with the same results. I need to fix a someone code and trying to simulate it in my environment.

Thanks for asking right questions..,I figured it out. The code is run as part of the expect script i.e

#!/usr/bin/expect -f
spawn ssh oracle@$myserver $mycommand
match_max 100000
expect "*?assword:*"
send "$v_password\r"
send "\r"
expect eof

Thank you

1 Like