I have a bunch of several bash scripts that will perform some actions that require user input, therefore I'm using expect with it.
However, I need one to keep running. But if I use expect, the expect command will wait while the script is running and my main script will not continue.
IE: script1 spawns a script as root:
#!/bin/bash
expect << EOF
spawn su root -c "/bin/bash script2.sh"
expect "Password:"
send "test\n"
set timeout -1
expect eof;
EOF
script2.sh will spawn a screen:
#!/bin/bash
screen -dm nastyscript.sh
nastyscript.sh will spawn a binary that must keep running:
#!/bin/bash
expect << EOF
spawn mybinary
expect "*Enter password for my binary"
send "test\r"
expect "*I am running"
set timeout -1
expect -re . { exp_continue } eof { exit }
expect eof;
EOF
But, since one script is waiting for expect to finish, my main script won't continue.
Any way to do that?