sexpect

Expect-like tool for automating interactive shell commands

brewmacoslinux
Try with needOr install directly
Source

About

Expect for shells

Commands

sexpect

Examples

Start an interactive session and send commands$ sexpect spawn bash sexpect send 'echo hello' sexpect expect 'hello'
Automate SSH login with password$ sexpect spawn ssh user@host sexpect expect 'password:' sexpect send 'mypassword' sexpect expect '$'
Check if command output contains expected string$ sexpect spawn ftp ftp.example.com sexpect expect 'Connected' sexpect send 'quit'