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.