-
-
Save x-yuri/c746d51cb075269731122ee739f06c46 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eu | |
echo ' | |
spawn ./1.sh | |
expect > | |
send cmd1\n | |
expect "\nd " ;# it matches | |
send quit\n | |
' | expect -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./2.sh | |
expect version 5.45 [6/91679] | |
argv[0] = expect argv[1] = -d | |
set argc 0 | |
set argv0 "expect" | |
set argv "" | |
executing commands from command file | |
spawn ./1.sh | |
parent: waiting for sync byte | |
parent: telling child to go ahead | |
parent: now unsynchronized from child | |
spawn: returns {31239} | |
expect: does "" (spawn_id exp6) match glob pattern ">"? no | |
> | |
expect: does "> " (spawn_id exp6) match glob pattern ">"? yes | |
expect: set expect_out(0,string) ">" | |
expect: set expect_out(spawn_id) "exp6" | |
expect: set expect_out(buffer) ">" | |
send: sending "cmd1\n" to { exp6 } | |
expect: does " " (spawn_id exp6) match glob pattern "d"? no | |
cmd1 | |
expect: does " cmd1\r\n" (spawn_id exp6) match glob pattern "d"? yes | |
expect: set expect_out(0,string) "d" | |
expect: set expect_out(spawn_id) "exp6" | |
expect: set expect_out(buffer) " cmd" | |
send: sending "quit\n" to { exp6 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment