I have a variable $myvar that might end in "_test" or might not. I want to test on it using grep to see if it has this value and only at the end of the variable.
This code works:
I then test the $test var like so:
This all works fine... but when I add my OR logic into the grep, I cannot get this to work in order to check for variations of "_test" like "_Test" or "_TEST". Here is one of the many examples of what I have tried with no luck:
Can anyone help ? Thanks.
This code works:
Code:
test=echo $myvar | grep '_test$'
I then test the $test var like so:
Code:
if [ -z "$test" ]
then
Alert_Type="Production"
else
Alert_Type="Test"
fi
This all works fine... but when I add my OR logic into the grep, I cannot get this to work in order to check for variations of "_test" like "_Test" or "_TEST". Here is one of the many examples of what I have tried with no luck:
Code:
test=echo $myvar | grep '_test$|_Test$|_TEST$'