#!/bin/ksh93
while :
do
read MAC?"Enter MAC address: "
case "$MAC" in
({2}([[:xdigit:]]){5}(:{2}([[:xdigit:]])))
break;;
esac
echo "Invalid MAC address"
done
It is equivalent to "while true" in this shell script. You can use "while true" - the more common and documented syntax - instead of "while :" if you so wish.
#!/bin/bash
while true
do
read -p "Enter MAC address: " MAC
case "$MAC" in
[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]])
break;;
esac
echo "Invalid MAC address"
done
The script may or may not work for your version of ksh. There are several version of ksh in common use. ksh88 is the original Korn Shell. pdksh is the public domain version of ksh88. It does not seen to be actively maintained. Solaris uses a heavily modified version of ksh88.