Once upon a time, Jonathan Kamens <jik@xxxxxxxxx> said: > This, however, is fine: > > [ "$WEBALIZER_CRON" != yes ] > > because the quotes ensure that the statement will be evaluated with an > expression to the left of the != even if the expression is just an empty > string. > > This is fine too: > > [ z$WEBALIZER_CRON != zyes ] > > because if the variable is empty, the expression to the left will be "z" > rather than an empty string. The reason some use a combination of quotes and a leading character is for testing user-provided input. It shouldn't matter in this case, but it is just a little bit more defensive programming. The problem if you are testing a user-provided variable is that they could give input that starts with a dash, a close bracket, etc., and that would screw up the test. Putting a character at the start protects against that. Also, always quoting the variable is good programming practice; it could have whitespace in it, in which case the non-quoted version would expand to multiple tokens (and again break). So, still today, the best defensive way is: [ "z$WEBALIZER_CRON" != zyes ] -- Chris Adams <cmadams@xxxxxxxxxx> Systems and Network Administrator - HiWAAY Internet Services I don't speak for anybody but myself - that's enough trouble. -- test mailing list test@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe: https://admin.fedoraproject.org/mailman/listinfo/test