Created
August 17, 2017 05:26
-
-
Save yui0/04f40655743da2f9dfb98bb2e4ae6b92 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
auto_ssh() { | |
host=$1 | |
id=$2 | |
pass=$3 | |
expect -c " | |
set timeout 10 | |
spawn ssh ${id}@${host} | |
#expect \"Are you sure you want to continue connecting (yes/no)?\" | |
#send \"yes\n\" | |
expect \"${id}@${host}'s password:\" | |
send \"$pass\n\" | |
expect \"# \" | |
send \"cd /opt/work/ ; ls\n\" | |
interact | |
" | |
} | |
auto_ssh '10.10.10.10' 'root' 'password' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment