bug-bash
[Top][All Lists]
Advanced

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

[[ -z ]] nullglob problem?


From: Linus Swälas
Subject: [[ -z ]] nullglob problem?
Date: Thu, 25 Oct 2007 00:34:37 +0200
User-agent: Opera Mail/9.50 (Linux)

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -O2 -march=pentium-m -mmmx -msse -pipe uname output: Linux miranda 2.6.23 #3 PREEMPT Wed Oct 17 21:07:21 CEST 2007 i686 i686 i386 GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 3.1
Patch Level: 0
Release Status: release

Description:
[[ -z seem to handle nullglob variables incorrect.
See the Repeat-By below.

Repeat-By:

mkdir empty
shopt -s nullglob
if [[ -z empty/* ]]
then
        echo empty
fi

Shouldn't this echo empty?

echo empty/* echoes nothing, as it should since nullglob is set.
However, the test if [[ -z empty/* ]] evaluates to false, not
true as it should. Or shouldn't it?

This works with [ anyway:

if [ -z empty/* ]
then
        echo empty
fi

echoes empty.

Fix:
Use [ instead of [[.


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]