fix hostname extraction
[dell-switch] / mac4ip.sh
index bff38a5..ec3c98f 100755 (executable)
--- a/mac4ip.sh
+++ b/mac4ip.sh
@@ -1,6 +1,6 @@
 #!/bin/sh -e
 
-ip=$1
+name=$1
 
-ping -c 1 $ip >&2 && \
+ip=$( ping -c 1 $name | grep '^PING' | cut -d' ' -f3 )
 /usr/sbin/arp -an | grep "\($ip\)" | awk '{ print $4 }'