Created
December 26, 2016 06:21
-
-
Save itkq/b6b0db03a74a6b5a15affde33baffc17 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
set -e | |
if [ ! `which envchain` ]; then | |
echo 'envchain not found' | |
exit 1 | |
fi | |
if [ $# -ne 1 ]; then | |
echo "Usage: envchain-ssh host" 1>&2 | |
exit 1 | |
fi | |
HOST=$1 | |
PW=`envchain ssh printenv $1` | |
expect -c " | |
set timeout 5 | |
spawn ssh ${HOST} | |
expect \"password:\" | |
send \"${PW}\n\" | |
expect \"$\" | |
interact | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment