This question already has an answer here:
- Why 'x' used in [ x“$VAR” = x“VALUE” ]? 5 answers
Today I saw the following comparison in an IBM shell script:
if [ "X$DEBUG" != "X" ]
then
# do stuff here
fi
What's the purpose of the X in the if statement?
Why not simply compare it as:
if [ "$DEBUG" != "" ]
Or:
if [ -z "$DEBUG" ]
Aucun commentaire:
Enregistrer un commentaire