Bash scripting, how to remove trailing substring, case insensitive?

I am modifying a script that reads in a user email. It is very simple, too simple.

echo -n "Please enter your example.com email address: "
read email
email=${email%%@example.com} # removes trailing @example.com from email
echo "email is $email"

This works, but only for lower case @example.com. How could I modify this to remove the trailing @example.com, case insensitive?

5
задан basher1 1 December 2010 в 22:40
поделиться