Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

both [[ string1 == string2 ]] and [[ string1 = string2 ]] means equal. But some other guy told me their machine don't support ==. The error message is: syntax error: `==' unexpected.

Seems they use pretty old UNIX with korn shell and I'm using REHL5.2. Since I cannot access their machines, how do I find out which version start to support "=="?


share|improve this question

You can look at the value of $SHELL and see if it's set to the shell's executable. You could then test and branch on the value of it, or lack thereof; I don't know if this will be set on older shells.

If you don't need the advanced features of [[ then use [ instead. This web page explains the differences in detail. Also take a look at this related question.

If you are only going to compare strings with == then use the POSIX syntax for the greatest compatibility: [ string1 = string2 ] which uses a single equals sign.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.