testing: ssh script accepts IP addresses instead of host names

This commit is contained in:
Tobias Brunner 2013-03-04 11:55:26 +01:00
parent 5057455674
commit 45ee7c9429

View File

@ -10,11 +10,18 @@ then
fi fi
host=$1 host=$1
ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" echo "$host" | grep -q "^\([0-9]\+\.\|[0-9a-fA-F]\+:\).*"
if [ -z $ip ] if [ $? -eq 0 ]
then then
echo "Host '$host' unknown" # assume we got an ip address
exit 1 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 fi
shift shift