Search This Blog

Wednesday, July 28, 2010

Safest way of comparing values using Variable.

Method 1:
if [ "x$HAVE_CIFS" = "xyes" ]; then

Method 2:
if [ "$HAVE_CIFS" = "yes" ]; then

in above 2 methods method one is safest as it deals with versions of "test" that don't deal with empty strings correctly.

Now onwards i will try to use the safest way whenever is possible.


More of Robust scripting article can be found in following blog entry.

No comments:

Post a Comment