First, run sh test.sh error
test.sh: Line 7: spawn: command not found
test.sh: line 10: send: command not found
test.sh: line 11: interact: command not found
the cause:
First, you should not use sh, because this is the expect script, direct the implementation of ./e.sh or expect ./e.sh
second, confirming expect under / usr / local / bin
Reference: https: //zhidao.baidu.com/question/752884072154466924.html