Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

shell script argument parsing

Shell Programming and Scripting

Thread Tools Search this Thread Display Modes
Old Unix and Linux 07-28-2005   -   Original Discussion by rmjoe
rmjoe's Unix or Linux Image
rmjoe rmjoe is offline
Registered User
Join Date: Jul 2005
Last Activity: 28 July 2005, 3:49 PM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Unix or Linux Question shell script argument parsing

how to parse the command line argument to look for '@' sign and the following with '.'.
In my shell script one of the argument passed is email address. I want to parse this email address to look for correct format.

rmjoe123@hotmail.com has '@' sign and followed by a '.'

to be more specific :

>abc.sh rmjoe123@hotmail.com

abc.sh should parse this email address and look for '@' and then '.'. If email address is valid, abc.sh should continue doing what it is doing. Otherwise abort with error message.
Sponsored Links
Old Unix and Linux 07-28-2005   -   Original Discussion by rmjoe
vgersh99's Unix or Linux Image
vgersh99 vgersh99 is offline Forum Advisor  
Forum Advisor
Join Date: Feb 2005
Last Activity: 18 March 2018, 11:19 AM EDT
Location: Foxborough, MA
Posts: 8,225
Thanks: 238
Thanked 800 Times in 746 Posts

echo 'a@b.com' | grep -q '.*@.*\..*'
echo $?

echo 'a@bcom' | grep -q '.*@.*\..*'
echo $?

Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How we can pass the argument when calling shell script from perl script anuragpgtgerman Shell Programming and Scripting 5 03-21-2012 03:57 PM
parsing argument in perl linuxgeek Shell Programming and Scripting 4 08-31-2011 09:42 AM
Perl Parsing Argument mingming88 Shell Programming and Scripting 0 05-16-2009 11:30 AM
Shell script $0 argument painulyarun UNIX for Dummies Questions & Answers 2 03-25-2008 07:32 PM
argument parsing... midhun_u Shell Programming and Scripting 1 07-25-2006 10:38 AM

All times are GMT -4. The time now is 03:37 PM.