I am writing a simple bash script where user input the domain name (example.com) and it greps the email address from whois command output.
I want only grep the email with the same input domain ([email protected]).
Below command works if I write the domain (example.com
) but does not work with $domain
. I do not know how to use the $domain
variable within the grep function. Any help is very much appreciated, thank you.
whois $domain | grep -m1 -EiEio '\b[A-Z0-9._%+-]+@[$domain]+\.[A-Z]{2,4}\b'