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


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 07-28-2005
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
    #2  
Old Unix and Linux 07-28-2005
vgersh99's Unix or Linux Image
vgersh99 vgersh99 is online now Forum Advisor  
Forum Advisor
 
Join Date: Feb 2005
Last Activity: 18 October 2017, 10:32 AM EDT
Location: Foxborough, MA
Posts: 8,197
Thanks: 228
Thanked 785 Times in 732 Posts

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

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

Sponsored Links
Closed

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 10:47 AM.