From 5718f0992422246d34cf04e73fdd468f6e581ead Mon Sep 17 00:00:00 2001 From: uwerler Date: Fri, 31 May 2019 08:47:51 +0000 Subject: [PATCH] fix ip address handling again --- ssh.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ssh.sh b/ssh.sh index e146277..16636bc 100644 --- a/ssh.sh +++ b/ssh.sh @@ -51,11 +51,10 @@ exit 1 _checkname(){ - # parse the output from ssh -G for _l; do case $_l in hostname) - + # make stupid check if hostname is an IP [[ ${SHELL} == *bash ]] && shopt -s extglob _ip=${2##+([0-9]).+([0-9]).+([0-9]).+([0-9])} @@ -78,11 +77,10 @@ _checkname(){ shift done - [[ ${SHELL} == *bash ]] && printf ${_host} || print -r -- ${_host} } _runxdotool(){ - + # with xdotool installed, activate the window or reattach to a detached session if type xdotool >/dev/null; then @@ -145,7 +143,7 @@ _ssh() { # let ssh parse the command line so we are sane # avoid overriding the hostname via main config - _host=$(_checkname $(/usr/bin/ssh -F /dev/null -G $@)) + _checkname $(/usr/bin/ssh -F /dev/null -G $@) fi [[ $($_tmux list-session -F "#S" 2>/dev/null) == *${_sess}* ]] && _s=${_sess}