[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in solaris 10 /bin/ksh w.r.t. test -z ")"
From: |
Eric Blake |
Subject: |
Re: Bug in solaris 10 /bin/ksh w.r.t. test -z ")" |
Date: |
Tue, 07 Sep 2010 08:38:16 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100827 Red Hat/3.1.3-1.el6 Mnenhy/0.8.3 Thunderbird/3.1.3 |
On 09/07/2010 08:24 AM, Stefano Lattarini wrote:
Hello autoconfers.
Is anyone aware of this ridicoulous bug of Solaris 10 /bin/ksh?
The manual already documents that it is non-portable:
Posix also says that @samp{test ! "@var{string}"},
@samp{test -n "@var{string}"} and
@samp{test -z "@var{string}"} work with any string, but many
shells (such as Solaris, AIX 3.2, UNICOS 10.0.0.6,
Digital Unix 4, etc.)@: get confused if
@var{string} looks like an operator:
Therefore,
$ /bin/ksh -c 'test -z ")"; echo $?' # ready to laugh or cry?
0
this is yet another case of @var{string} that looks like an operator,
and yet another reason that you should ALWAYS use test x"$val" = x
rather than test -z "$val" if you don't know what $val contains.
But yes, giving this particular example in the manual would be helpful.
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org