Hi Jonathan,

On Fri, 2010-11-05 at 03:17:13 -0500,
Jonathan Nieder <jrnie...@gmail.com> wrote:
> > Please try
> >   % bash -c 'test ! -a . && echo true'
> > and compare with the result of
> >   % bash -c '/usr/bin/test ! -a . && echo true'
> 
> So which one is right?

Both should echo "true", but the former did not: I found that the former
sometimes returns the correct result, but have not found what makes the
difference.  Plus, this problem might have been fixed in current stable
(Version: 3.2-4) package: I cannot represent the problem now.

According to the help command, the '-a FILE' file operator returns true
if file exists.

> My recommendation is to never use the ! or -a 'test' operators.
> They are superfluous next to the shell-supported ! and &&.
> POSIX does not mandate support for -a (though XSI does), perhaps for
> this reason.

I agree with your recommendation: I usually use '-e' operator.
I found this problem when debugging a code written by my colleague.

Thanks,
Masanobu



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to