#!/bin/bash
# michaszek@o2.pl
# ver 0.1

dothejob() {
arping=`arping -c 1 $1 | grep from | awk '{print $4}'`
if [[ $arping == *:* ]]; then echo "IP: $1 - MAC: $arping"; exit 0; fi
echo "IP: $1 - is not occupied"; exit 0;
exit 0
}

if [ -n "$1" ]
then
dothejob $1
else
echo "Usage: check_arping.sh HOST-IP"
exit 0
fi
