Skip to content

Instantly share code, notes, and snippets.

@woosley
Last active January 26, 2016 08:18
Show Gist options
  • Save woosley/ae7f5c0b8d553186219f to your computer and use it in GitHub Desktop.
Save woosley/ae7f5c0b8d553186219f to your computer and use it in GitHub Desktop.
#!/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