Last active
August 9, 2023 23:03
-
-
Save nachivpn/ff2e2b8cf647af633127 to your computer and use it in GitHub Desktop.
Running an expect script in the background
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for your help man! You make my day )