[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Conditional expression problem: both "-a file" and "! -a file" return tr
From: |
re2823 |
Subject: |
Conditional expression problem: both "-a file" and "! -a file" return true |
Date: |
Fri, 6 Jan 2006 22:02:38 +0000 |
Hi.
Excuse me if I've got things somewhat confused here (I'm a complete Unix
newbie), but I've found what I think is a bug.
If I create a file using:
user@machine:~$ touch testFile
and then run the following two lines, I get conflicting results:
user@machine:~$ [ -a testFile ] && echo true || echo false
true
user@machine:~$ [ ! -a testFile ] && echo true || echo false
true
Like I said, I'm only a Unix newbie, so I'm really unsure whether this is a
problem, or whether it's expected behaviour, but in my searching for
information, I found:
http://www.faqs.org/faqs/unix-faq/shell/bash/
and point E1 ("Why is the bash builtin `test' slightly different from
/bin/test?") seems to indicate that the two results should be the "opposite"
of each other.
By the way, here's some information created by running bashbug on my machine:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib
-g -O2
uname output: Linux machine 2.6.12-10-686 #1 Thu Dec 22 11:55:07 UTC 2005
i686 GNU/Linux
Machine Type: i486-pc-linux-gnu
Bash Version: 3.0
Patch Level: 16
Release Status: release
Anyway, I'd really appreciate any comment from anyone who can shed light on
this...
Thank you,
Dave
- Conditional expression problem: both "-a file" and "! -a file" return true,
re2823 <=