Here is pure bash code to check MAC address syntax, inspired by IP validation code from cfajohnson :
valid_mac_address () { ERROR=0 oldIFS=$IFS IFS=: set -f set -- $1 if [ $# -eq 6 ]; then for seg; do case $seg in ""|*[!0-9a-fA-F]*) ERROR=1 break ;; # Segment empty or non-hexadecimal ??) ;; # Segment with 2 caracters are ok *) ERROR=1 break ;; esac done else ERROR=2 ## Not 6 segments fi IFS=$oldIFS set +f return $ERROR }