Whilst PHV is right, case is usually best for multiple choices, to help understand the test syntax
'-eq' is numeric equality, '=' is string equality
The double pipe should be used for the 'or' condition
so your code should be
Code:
if [ "$opt3" = 'failed' || "$opt3" = 'FAILED' ]
Another answer to the case sensitive match problem is
Code:
set -u testvar # testvar is force into upper case
testvar=$opt3
if [ "$testvar" = 'FAILED' ]
The double quotes around $opt3 and $testvar is to stop the test failing with a missing value error if $opt3 is the null string
Thanks! All great suggestions. I took the idea of "set -u var" and added a "-u" to typeset command already used to set the varibles when the code was orginally written. It works like a champ.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.