Skip to content

Instantly share code, notes, and snippets.

@nachivpn
Last active August 9, 2023 23:03
Show Gist options
  • Save nachivpn/ff2e2b8cf647af633127 to your computer and use it in GitHub Desktop.
Save nachivpn/ff2e2b8cf647af633127 to your computer and use it in GitHub Desktop.
Running an expect script in the background
#!/usr/bin/expect -f
set host "host"
set password "password"
spawn ssh $host
expect {
"(yes/no)?" {
send -- "yes\r"
exp_continue
}
"*password:*" {
send -- "$password\r"
}
}
##Removing this:
#interact
##And adding this:
expect eof
exit
@gingerbeardman
Copy link

gingerbeardman commented Oct 22, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment