From: Tobias Brunner Date: Mon, 4 Mar 2013 10:55:26 +0000 (+0100) Subject: testing: ssh script accepts IP addresses instead of host names X-Git-Tag: 5.0.3dr3~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=45ee7c9429dc61ac355e5bebbaa77e711495cb67;p=thirdparty%2Fstrongswan.git testing: ssh script accepts IP addresses instead of host names --- diff --git a/testing/ssh b/testing/ssh index 9e6d49a610..0de44d0a9b 100755 --- a/testing/ssh +++ b/testing/ssh @@ -10,11 +10,18 @@ then fi host=$1 -ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" -if [ -z $ip ] +echo "$host" | grep -q "^\([0-9]\+\.\|[0-9a-fA-F]\+:\).*" +if [ $? -eq 0 ] then - echo "Host '$host' unknown" - exit 1 + # assume we got an ip address + ip=$host +else + ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" + if [ -z $ip ] + then + echo "Host '$host' unknown" + exit 1 + fi fi shift