[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What shells fail to work if comparing with "" ?
From: |
David Kirkby |
Subject: |
Re: What shells fail to work if comparing with "" ? |
Date: |
Thu, 10 Feb 2011 20:07:17 +0000 |
On 10 February 2011 18:56, Dr. David Kirkby <address@hidden> wrote:
> 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
Oops, I meant to put
if [ "x$STR" = x ] ; then