[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug with 'test' built-in.
From: |
John Wenker |
Subject: |
Bug with 'test' built-in. |
Date: |
Wed, 9 Aug 2006 15:03:08 -0700 |
From: jjw@pt.com
To: bug-bash@gnu.org
Subject: Bug with 'test' built-in.
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' -DSHELL -DHAVE_CONFIG_H -D_GNU_SOURCE -I. -I.
-I./include -I./lib -O2 -march=i386 -mcpu=i686
uname output: Linux ragtop 2.4.18-3 #1 Thu Apr 18 07:32:41 EDT 2002 i686
unknown
Machine Type: i686-pc-linux-gnu
Bash Version: 2.05a
Patch Level: 0
Release Status: release
Description:
There is a problem using '!' (boolean negation) with the -a flag
of the 'test' built-in command. The following construct
_always_ evaluates true, regardless of whether the file exists
or not.
if [ ! -a file ]; then
echo "This line always prints no matter what."
else
echo "This line never prints."
fi
Using -a w/o the negation works fine.
Repeat-By:
[Describe the sequence of events that causes the problem
to occur.]
Fix:
[Description of how to fix the problem. If you don't know a
fix for the problem, don't include this section.]