What shells fail to work if comparing with "" ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I know its considered bad practice to check for an empty string with something like:

if [ "$STR" = "" ] ; then

but what shells do actually break with this, and under what conditions?


I was proposing someone change a test like that to

if [ "x$STR" =  ] ; then

but someone has argued against this, saying he knows of no shell where the former is not acceptable. I realise this issue is probably more of a problem with older shells, but can anyone give me any examples of where the former will break, but the latter will be ok?



--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

Dave


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf


[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux