From a41d84d4925c489dfa907c6a431316125e1ac7b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Wed, 21 Sep 2022 15:51:44 +0200 Subject: [PATCH] add functionality to open more connections to the same server in split tmux pane with sshs --- bash_completion.d/sshs | 2 +- functions.sh | 6 ++++++ sshs | 6 ++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/bash_completion.d/sshs b/bash_completion.d/sshs index ea780ca..f746716 100644 --- a/bash_completion.d/sshs +++ b/bash_completion.d/sshs @@ -1,3 +1,3 @@ [ -e /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion [ -e /usr/share/bash-completion/completions/ssh ] && . /usr/share/bash-completion/completions/ssh -shopt -u hostcomplete && complete -F _ssh sshs +shopt -u hostcomplete && complete -F _ssh sshs setserver diff --git a/functions.sh b/functions.sh index 5fe31f6..47a8235 100755 --- a/functions.sh +++ b/functions.sh @@ -1259,5 +1259,11 @@ gocnfshome() { cd "${APP_SHARED_HOME}" } +setserver() { + export sshcon="$@" + if [ -n "${TMUX}" ]; then + tmux set-environment sshcon "$@" + fi +} #EOF diff --git a/sshs b/sshs index 9c0264b..4050171 100644 --- a/sshs +++ b/sshs @@ -1,8 +1,10 @@ #!/bin/sh sshs() { ENTRY - - + [ $# -eq 0 ] && { [ "${sshcon:-x}" == "x" ] || set -- "${sshcon}"; } + if [ -n "${TMUX}" ]; then + tmux set-environment sshcon "$@" + fi local LOGLEVEL="WARN" # MKTMPCMD='mktemp $(echo ${XDG_RUNTIME_DIR}/bashrc.XXXXXXXX.conf)' # VIMMKTMPCMD="mktemp ${XDG_RUNTIME_DIR}/vimrc.XXXXXXXX.conf"