mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-08 00:02:03 -04:00
testing: ssh script accepts IP addresses instead of host names
This commit is contained in:
parent
5057455674
commit
45ee7c9429
@ -10,12 +10,19 @@ then
|
||||
fi
|
||||
|
||||
host=$1
|
||||
echo "$host" | grep -q "^\([0-9]\+\.\|[0-9a-fA-F]\+:\).*"
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
# 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
|
||||
exec ssh $SSHCONF -q root@$ip $@
|
||||
|
Loading…
x
Reference in New Issue
Block a user