bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Test -a and -e


From: Chet Ramey
Subject: Re: Test -a and -e
Date: Mon, 09 Nov 2009 17:30:57 -0500
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)

Jan Schampera wrote:
> Hello list,
> 
> Code:
> $ [ ! -e /bin/bash ] && echo "Doesn't exist"; [ -e /bin/bash ] && echo
> "Exists"
> 
> Output:
> Exists
> 
> 
> Code:
> $ [ ! -a /bin/bash ] && echo "Doesn't exist"; [ -a /bin/bash ] && echo
> "Exists"
> 
> Output:
> Doesn't exist
> Exists
> 
> 
> It seems there's a difference between -a and -e, though they are (as far
> as I can see) documented to do the same thing.

Please read the Bash FAQ, question E1.  The behavior of test depends on
the number of arguments; the rules are in the manual page.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]