bash expect: script to handle command line prompts


expect is very useful to automate login process. I thought it is helpful when doing testing as well. A simple login script might work like this:

#!/usr/bin/env expect
eval spawn "/path/program"
expect "^Enter Auth Username:"
send "user\n"
expect "Enter Auth Password:"
send "password\n" 

To install expect, “yum install expect”

Like it.? Share it:
Tags:

Comments are closed.