Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- USER="login"
- PASS="password"
- HOST="host1
- host2"
- expect_cmd() {
- cat <<EOF
- set timeout 60
- spawn ssh $USER@$HOST
- expect {
- "*(yes/no)?*" {
- send "yes\r"
- }
- "*password:" {
- send "$PASS\r"
- }
- }
- expect {
- "*password:" {
- send "$PASS\r"
- }
- }
- expect {
- "*:~" {
- send "sudo dpkg -i ~/share/path/to/*.deb\r"
- }
- }
- expect {
- "*word:" {
- send "$PASS\r"
- }
- }
- expect {
- "*:~" {
- send "exit\r"
- }
- }
- EOF
- }
- for HOST in $HOST; do
- /usr/bin/expect -c "$(expect_cmd)"
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement