ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
No - Since you don't tell us what YOUR expected result is and what result you are getting that you think is wrong.
However, a couple of things that I notice:
1) You have a space between test= and the variable - that is not correct - you need to remove the space.
2) You have quotes around the variable ("A") which are unnecessary and might be treated literally in some contexts.
3) You do not have a space before your final right bracket which means the test is not recognized as such.
4) You not need quotes around $test in your test statements.
Try not to use negative checks (!=) try positive once (==) whenever possible. Have a look at these 2 examples:
if [ ! -z $test ]
if [ "$test" == "AB" ]
echo "first: Match"
echo "first: No Match"
if [ "$test" == "AB" ] || [ "$test" == "BC" ]
echo "second: Match"
echo "second: No Match"