![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
| Display Modes | Rate This Thread |
|
|