[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Conditional expression problem: both "-a file" and "! -a file" return tr
Conditional expression problem: both "-a file" and "! -a file" return true
Fri, 6 Jan 2006 22:02:38 +0000
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:
address@hidden:~$ touch testFile
and then run the following two lines, I get conflicting results:
address@hidden:~$ [ -a testFile ] && echo true || echo false
address@hidden:~$ [ ! -a testFile ] && echo true || echo false
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:
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:
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib
uname output: Linux machine 2.6.12-10-686 #1 Thu Dec 22 11:55:07 UTC 2005
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
- Conditional expression problem: both "-a file" and "! -a file" return true,