2 ms·
I've recently become a fan of expect-lite[1], which has a much simpler syntax. Here are some examples: Check the IP address of the localhost >ifconfig
by pmoriarty 7y ago
I've recently become a fan of expect-lite[1], which has a much simpler syntax.
Here are some examples:
Check the IP address of the localhost
>ifconfig
<192\.168\.1\.1
>ip -6 addr show
<2001:db8::f00d
ssh to a remote host
>ssh root@host-021
<assword:
>>secret_password
# issue a command once logged in
>ls
>exit
[1] - http://expect-lite.sourceforge.net/ http://expect-lite.sourceforge.net/
- erredois 7y agoThank you for this, looks amazing to create simple tests
- ohithereyou 7y agoInputting an SSH password using an expect script seems like an anti-pattern to me. In general, why can't you use a password-less key on the client and restrict what commands it can execute in the authorized_keys file on the server?
- ebcode 7y ago... because you don't control the server?