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 and shell scripting languages 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 07:32 PM
problem with spaces and argument parsing fabulous2 Shell Programming and Scripting 8 12-19-2007 11:27 AM
printing last argument in shell script arunkumar_mca Shell Programming and Scripting 5 10-03-2006 09:32 PM
argument parsing... midhun_u Shell Programming and Scripting 1 07-25-2006 11:38 AM
command line argument parsing rmjoe UNIX for Dummies Questions & Answers 1 07-28-2005 04:39 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-28-2005
rmjoe rmjoe is offline
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.
  #2 (permalink)  
Old 07-28-2005
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

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

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

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:44 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0