From 9083bfc5ad1c82bcd28b511f6b7b3ab162f7e415 Mon Sep 17 00:00:00 2001 From: Kevin Baensch Date: Sat, 24 Dec 2022 19:48:31 +0100 Subject: [PATCH] Remove debug message and wrap more variables. --- script/myssh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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}"