This is a much nicer solution I have implemented it into the script and it works great!!!! If I may ask for your input again. How would you have the shell look for an initial space at the beginning of the email address. For example:
Enter email address EDI>
milenko.villanueva@yahoo.com
vs
Enter email address EDI>
milenko.villanueva@yahoo.com
===========
The second email address has a couple of spaces in front of it so when it writes it to the email file ....... spaces go with it. It would be great if when some typed in spaces before the email address for the shell to prompt the user "Email Address contains invalid characters".
Looking forward to your reply.
Quote:
Originally posted by aigles
Try this modified version of your script (accep only alphanumeric characters and @ . - );
Code:
while echo "Enter email address EDI> \c" ; do
read email
case "$email" in
*[!@.a-zA-Z0-9\-]*)
echo "Email Address contains invalid characters"
continue
;;
"")
echo "Empty fields not allowed"
continue
;;
*) if [ `expr length "$email"` -gt 50 ]
then
echo "Maximun 50 Characters permitted"
else
break
fi
;;
esac
done
|