The general idea may be something like the one shown below.
spawn ssh session- enter correct login
- Send each command with
send - Wait for the desired exit with
expect
Example:
spawn ssh $user@ $domain expect "password" { send "$pwd\r"} expect "#";
The word to wait after executing the command may vary depending on your system. It can be # or $ or > or:; So, make sure you give the right one. Or you can provide a generic template for a tooltip per se
set prompt "#|>|:|\\\$";
When using expect after sending commands, it can be used as
expect -re $prompt;
source share