0

I'd like to know what's the syntax for this kind of if in ksh :

if [[ $tmpEngine != "a" || $tmpEngine != "b" || $tmpEngine != "s" ]]; then
   ...
fi

Actually, my code doesn't work, what's the problem here ? The problem is not about the meaning of my if, but rather how to write it correctly from a syntax point of view.

3

Whatever $tmpEngine value, this test is always true, I mean, $tmpEngine cannot be a, b and s at the same time so at least two of the comparisons are always true.

You probably want:

if [[ "$tmpEngine" != "a" && "$tmpEngine" != "b" && "$tmpEngine" != "s" ]]; then
   ...
fi
  • You right, small mistake from my side but anyway, my code doesn't work because of a syntax problem. – user1058398 Nov 28 '13 at 7:23
  • Do you mean my answer doesn't address the problem described ? – jlliagre Nov 28 '13 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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