John Wenker wrote:
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
And despite this version being ancient, I'll point out that I can
reproduce (assuming this isn't a case of wrong syntax) on
"3.00.15(1)-release" (whatever that is; came with FC4) and 3.1.17 built
from sources.
To venture a guess, it seems like '-a' is being parsed as 'and' in this
case, rather than the test for file existence.
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.
--
Matthew
vIMprove your life! Now on version 7!
_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash