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
BASH validate user input 602chrislys UNIX for Dummies Questions & Answers 2 07-28-2009 05:10 AM
validate input DDoS Shell Programming and Scripting 9 02-07-2009 06:21 PM
Need to validate a date input format rajugp1 Shell Programming and Scripting 2 02-02-2009 02:16 PM
How to validate input values SasDutta Shell Programming and Scripting 5 06-27-2007 03:16 AM
validate input from user for file name jerardfjay Shell Programming and Scripting 2 08-11-2005 12:53 PM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 08-25-2009
stuaz stuaz is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 13
Validate and sort input

Hi,

This will most likely be a simple answer.

Currently I have a situation where my script will be sent various options:


Code:
-o1 -o2 -oe3@somthing.com

Now, if I want to run a certain command based on the option I am sent, I am doing the following.


Code:
for o in $(echo $options)
do
  if [ $o == "1" ]
  then
  
run commands
        exit 0
  fi
  if [ $o == "2" ]
  then
          run commands
        exit 0
  fi
done

However you will notice from my first example I gave "-oe3@something.com"

I need to be able to find where "-eXXX" is and then remove the 'e' and use the bit after (3@something.com). Or if it is easier, just forget about the "e" and look for anything with "@" init, but I would perfer to do the "e" method.

This next bit is later on at somepoint.

I will then want to "validate" what I have to check that is it a valid email address (You know so that it has an @ sign a domain name etc.
 

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 06:32 AM.


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