Skip to content

Instantly share code, notes, and snippets.

@aemonair
Last active November 21, 2023 09:26
Show Gist options
  • Save aemonair/d25a56777a180396aaf689093ab09fb3 to your computer and use it in GitHub Desktop.
Save aemonair/d25a56777a180396aaf689093ab09fb3 to your computer and use it in GitHub Desktop.
expect
#!/usr/bin/expect
set timeout 30
set host "127.0.0.1"
set username "air"
set password "password"
trap {
set rows [stty rows]
set cols [stty columns]
stty rows $rows columns $cols < $spawn_out(slave,name)
} WINCH
spawn ssh -p 22 $username@$host
expect "*password*" {send "$password\r"}
expect "*~*" {send "!tmux\r"}
interact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment