From 69419a8f9c591be49543f78bb5ca561f89ed17bd Mon Sep 17 00:00:00 2001 From: Kevin Baensch Date: Fri, 6 Jan 2023 14:54:36 +0100 Subject: [PATCH] Myssh: make ssh not slurp stdin. --- script/myssh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/script/myssh b/script/myssh index 1880766..703a8fa 100755 --- a/script/myssh +++ b/script/myssh @@ -34,7 +34,7 @@ get_template_string() { } ssh_status() { - ssh -O check -S "${HOME}/.ssh/controlmasters/%r@%h:%p" "${SSH_SQL_PROXY_HOST}" > /dev/null 2>&1 + ssh -n -O check -S "${HOME}/.ssh/controlmasters/%r@%h:%p" "${SSH_SQL_PROXY_HOST}" > /dev/null 2>&1 } connect() { @@ -43,14 +43,14 @@ connect() { if ! ssh_status then echo "" > "${CONNECTION_CACHE}" - ssh -o "ControlPersist=10m" -M -S "${HOME}/.ssh/controlmasters/%r@%h:%p" "${SSH_SQL_PROXY_HOST}" q + ssh -n -o "ControlPersist=10m" -M -S "${HOME}/.ssh/controlmasters/%r@%h:%p" "${SSH_SQL_PROXY_HOST}" q fi } disconnect() { if ssh_status then - ssh -O stop -S "${HOME}/.ssh/controlmasters/%r@%h:%p" "${SSH_SQL_PROXY_HOST}" q + ssh -n -O stop -S "${HOME}/.ssh/controlmasters/%r@%h:%p" "${SSH_SQL_PROXY_HOST}" q fi } @@ -64,15 +64,15 @@ port_forward() { then if [ -n "${ACTIVE_HOST}" ] then - ssh -O cancel -L "6033:${ACTIVE_HOST}" -S "${HOME}/.ssh/controlmasters/%r@%h:%p" "${SSH_SQL_PROXY_HOST}" q + ssh -n -O cancel -L "6033:${ACTIVE_HOST}" -S "${HOME}/.ssh/controlmasters/%r@%h:%p" "${SSH_SQL_PROXY_HOST}" q fi - ssh -O forward -L "6033:$1:$2" -S "${HOME}/.ssh/controlmasters/%r@%h:%p" "${SSH_SQL_PROXY_HOST}" + ssh -n -O forward -L "6033:$1:$2" -S "${HOME}/.ssh/controlmasters/%r@%h:%p" "${SSH_SQL_PROXY_HOST}" fi echo "$1:$2" > "${CONNECTION_CACHE}" } ls_hosts() { - ssh -S "${HOME}/.ssh/controlmasters/%r@%h:%p" "${SSH_SQL_PROXY_HOST}" ls + ssh -n -S "${HOME}/.ssh/controlmasters/%r@%h:%p" "${SSH_SQL_PROXY_HOST}" ls } get_host() { @@ -81,7 +81,7 @@ get_host() { printf 'Please specify the host to connect to.\nRun "myssh ls" to list all available hosts.\n' exit 1 else - TARGET_HOST_DATA=$(ssh -S "${HOME}/.ssh/controlmasters/%r@%h:%p" "${SSH_SQL_PROXY_HOST}" "get $1") + TARGET_HOST_DATA=$(ssh -n -S "${HOME}/.ssh/controlmasters/%r@%h:%p" "${SSH_SQL_PROXY_HOST}" "get $1") if [ "${TARGET_HOST_DATA}" = '' ] then printf 'No such host: "%s"\n' "$1"