The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell script $0 argument painulyarun UNIX for Dummies Questions & Answers 2 03-25-2008 04:32 PM
problem with spaces and argument parsing fabulous2 Shell Programming and Scripting 8 12-19-2007 08:27 AM
printing last argument in shell script arunkumar_mca Shell Programming and Scripting 5 10-03-2006 05:32 PM
argument parsing... midhun_u Shell Programming and Scripting 1 07-25-2006 07:38 AM
command line argument parsing rmjoe UNIX for Dummies Questions & Answers 1 07-28-2005 12:39 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-28-2005
Registered User
 

Join Date: Jul 2005
Posts: 2
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.
Reply With Quote
Forum Sponsor
  #2  
Old 07-28-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
Code:
echo 'a@b.com' | grep -q '.*@.*\..*'
echo $?
0

echo 'a@bcom' | grep -q '.*@.*\..*'
echo $?
1
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:50 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0