Skip to content

Instantly share code, notes, and snippets.

@thinkerbot
Created October 14, 2011 01:56
Show Gist options
  • Save thinkerbot/1286058 to your computer and use it in GitHub Desktop.
Save thinkerbot/1286058 to your computer and use it in GitHub Desktop.
Expect example
##############################################
# env PS1='$ ' PS2='> ' expect -f script.txt
spawn /bin/sh
expect "$ " ; send "printf \"abc\\rxyz\\n\"\n"
expect "$ " ; send "printf \"abc\\fxyz\\n\"\n"
expect "$ " ; send "for n in one two; do\n"
expect "> " ; send " echo \$n\n"
expect "> " ; send "done\n"
expect "$ " ; send "exit \$?\n"
expect eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment