Skip to main content
3 of 3
edited title
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 238

Understanding echo/spawn/send/expect construct

Here is a line from a bash script I am trying to understand:

echo "spawn myscript.sh arg1 arg2; expect \"Please enter your value: \"; send \"myval\r\"; expect eof" | expect

I think I understand the first expect and the send.

Q1: Does expect work only with spawn?

Q2: What is the purpose of the last expect after the pipe?

Q3: In general, can you guess what the original author of this line was attempting to accomplish?

amphibient
  • 12.8k
  • 19
  • 69
  • 88