Re: Inconsistent string comparison operators n and z

2014-06-09 Thread Greg Wooledge
On Mon, Jun 09, 2014 at 01:11:31PM +, Thibault, Daniel wrote: > Consider these lines: > > $ if [ -z `pgrep pname` ]; then echo "not r" ; else echo "r" ; fi > $ if [ ! -z `pgrep pname` ]; then echo "r" ; else echo "not r" ; fi > $ if [ -n `pgrep pname` ]; then echo "r" ; else echo "not r" ;

Re: Inconsistent string comparison operators n and z

2014-06-09 Thread Eric Blake
On 06/09/2014 07:11 AM, Thibault, Daniel wrote: > Description: > The string comparison operators -n and -z are designed to be mutually > complementary. ! -z should be interchangeable with -n and ! -n should be > interchangeable with -z. But such is not the case. Consider these lines: The bug

Re: Inconsistent string comparison operators n and z

2014-06-09 Thread Dennis Williamson
On Jun 9, 2014 10:41 AM, "Thibault, Daniel" wrote: > > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-g