diff --git a/script/myssh b/script/myssh index fe52a16..dd7ef1a 100755 --- a/script/myssh +++ b/script/myssh @@ -60,14 +60,12 @@ disconnect() { # $2 - target port port_forward() { ACTIVE_HOST=$(cat $CONNECTION_CACHE) - if [ -z $ACTIVE_HOST ] || [ $ACTIVE_HOST != "$1:$2" ] + if [ -z "${ACTIVE_HOST}" ] || [ "${ACTIVE_HOST}" != "$1:$2" ] then - if [ ! -z $ACTIVE_HOST ] + if [ -n "${ACTIVE_HOST}" ] then - ssh -O cancel -L 6033:$ACTIVE_HOST -S $HOME/.ssh/controlmasters/%r@%h:%p ${SQL_PROXY_HOST} q + ssh -O cancel -L 6033:${ACTIVE_HOST} -S ${HOME}/.ssh/controlmasters/%r@%h:%p ${SQL_PROXY_HOST} q fi - echo $ACTIVE_HOST - echo $1 $2 ssh -O forward -L 6033:$1:$2 -S ${HOME}/.ssh/controlmasters/%r@%h:%p ${SQL_PROXY_HOST} fi echo "$1:$2" > "${CONNECTION_CACHE}"