I'm having trouble using sed to validate the length of an entry. I want to have a user enter a phone number of either length 7, 10 or 11. Only numbers are allowed. Does anyone know how to do this? Here's the code I have so far. It only validates that numbers are entered but not the length.
#make sure Phone Number only contains numbers
while [[ ! -z $(echo $phone | sed 's/[0-9]//g') ]]; do
echo ""
printf "Please Enter The Contacts Phone Number (only numbers are allowed): "
read phone
done