I have the following function:
testit()
{
[ "$1" == "OK" ] && echo "good" || echo "bad"
}
but it doesn’t work as expected. I can call it with:
testit 'OK' #good
testit 'abc' #bad
but when I call it with:
testit '('
it fails with: “sh: closing paren expected”. I’ve quoted the string to test, so why it acts like there are no quotes?
This is most likely a bug in your shell implementation. I have tested your code on the latest CentOS and it works fine.