Last active
January 26, 2016 08:18
-
-
Save woosley/ae7f5c0b8d553186219f 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/bash | |
function on_exit(){ | |
printf "\033kbash\033\\" | |
tmux set-window-option automatic-rename on >/dev/null 2>&1 | |
} | |
if [ $TERM = "screen" ];then | |
trap on_exit SIGINT SIGTERM | |
#hostname | |
a=${1##*@}; | |
all=("$@") | |
#echo all is $all | |
poped=("${all[@]:1}") | |
#echo ipoped is "${poped[@]}" | |
## for options like -v | |
echo $poped | grep -- - >/dev/null 2>&1 | |
if [[ $? == 0 || $# == 1 ]];then | |
printf "\033k$a\033\\" | |
/usr/bin/ssh -o ProxyCommand="ssh -A aws nc $1 22" $@ | |
tmux set-window-option automatic-rename on >/dev/null 2>&1 | |
else | |
## ssh host commands only | |
/usr/bin/ssh -o ProxyCommand="ssh -A aws nc $1 22" $@ | |
fi | |
else | |
/usr/bin/ssh -o ProxyCommand="ssh -A aws nc $1 22" $@ | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment