I'm having a brain problem this should be simple but I'm having problem figuring it out.
I have a script and I want it to check for arguments if none tell valid agrument and exit. Got that working. Now if the valid argument passed do something. If not stop. Here is where I'm brain dead.
Here is the simple script.
if [ ! "$1" ]
then
echo "Valid arguments are attack | test"
exit 1
else
if [ "$1" = attack ]
then
C=userdel
fi
if [ "$1" = test ]
then
C=" "
fi
if [ "$1" ! attack -o test ]
then
echo " I'm here"
exit 1
fi
fi
The first two if's work fine. Its the last if I'm stuck on. If the arguments are not attack or test exit 1. The script at this point keeps going. I thought the -o was a logical not. If its not attack or test exit 1 is what I'm tring to do. I know its simple I just can't remember the right way to put it. Thanks for any help.
I have a script and I want it to check for arguments if none tell valid agrument and exit. Got that working. Now if the valid argument passed do something. If not stop. Here is where I'm brain dead.
Here is the simple script.
if [ ! "$1" ]
then
echo "Valid arguments are attack | test"
exit 1
else
if [ "$1" = attack ]
then
C=userdel
fi
if [ "$1" = test ]
then
C=" "
fi
if [ "$1" ! attack -o test ]
then
echo " I'm here"
exit 1
fi
fi
The first two if's work fine. Its the last if I'm stuck on. If the arguments are not attack or test exit 1. The script at this point keeps going. I thought the -o was a logical not. If its not attack or test exit 1 is what I'm tring to do. I know its simple I just can't remember the right way to put it. Thanks for any help.