0

I have following expect file:

spawn ./SpeedVPN.sh [lindex $argv 0]
expect "password for user:"
send "123456789\r"
expect "Enter 'yes' to accept, 'no' to abort; anything else to view:"
send "yes\r"
expect "Username:"
send "vpnUserName\r"
expect "Password:"
send "vpnPassword\r"
expect "Established DTLS connection"
spawn ./ChangeMTU.sh 1300
expect "password for user:"
send "123456789\r"
interact

After the first spawn is done, I want to leave the opened VPN process running and meanwhile, I want to change the MTU. But when I spawn the next .sh file in the middle, it closes the VPN process which was opened by the first spawn and runs the second .sh file. What should I do?

tripleee
  • 175,061
  • 34
  • 275
  • 318
Masoudy BaBa
  • 383
  • 2
  • 12
  • 1
    See https://unix.stackexchange.com/questions/162069/expect-script-how-to-handle-two-processes for possible help. – Shawn Oct 20 '20 at 09:38
  • Thanks, spawn_id was the solution. altough i cound not expect stuff from the second spawn and i just interact with it – Masoudy BaBa Oct 20 '20 at 11:39

0 Answers0