Skip to content

Instantly share code, notes, and snippets.

@ik9999
Created March 1, 2016 03:22
Show Gist options
  • Save ik9999/6c7d0763864e157241a9 to your computer and use it in GitHub Desktop.
Save ik9999/6c7d0763864e157241a9 to your computer and use it in GitHub Desktop.
sshfs + expect
#!/usr/bin/expect -f
set timeout 20
spawn -ignore HUP sudo /usr/bin/sshfs SSH_LOGIN@SSH_URL:SSH_PATH DIR -p PORT -o allow_other
expect {
"sudo" {
send "SUDO_PASS\r"
exp_continue
}
"worker" {
send "SSH_PASS\r"
exp_continue
}
"\n" { }
default {
puts "def1"
}
}
expect {
"worker" {
send "SSH_PASS\r"
send_user "\n"
}
"\n" { }
default {
puts "def2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment