X-Spam-Check-By: sourceware.org
Date: Mon, 19 Dec 2005 10:24:34 -0500
From: Christopher Faylor <cgf-no-personal-reply-please@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: test -e cannot distinguish between foo and foo.exe
Message-ID: <20051219152434.GA10944@trixie.casa.cgf.cx>
Reply-To: cygwin@cygwin.com
References: <43A6CDA0.8060508@scytek.de> <43A6D04E.6020306@hones.org.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <43A6D04E.6020306@hones.org.uk>
User-Agent: Mutt/1.5.11
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Mon, Dec 19, 2005 at 03:22:54PM +0000, Cliff Hones wrote:
>Volker Quetschke wrote:
>> I noticed the following behaviour: (found by my favorite testcase ;) )
>> 
>> $ rm -rf foo* ; touch foo.exe
>> 
>> $ test -e foo && echo found foo
>> found foo
>> 
>> $ test -e foo.exe && echo found foo.exe
>> found foo.exe
>> 
>> Hmm, how can I test if foo exists without also looking at foo.exe?
>> Does this count as a bug in test?
>> 
>> My current workaround is
>> 
>> $ find . -maxdepth 1 -name foo -exec echo _XfoundX_ \; | grep _XfoundX_ >
>> /dev/null && echo found foo
>> 
>> but that is a bit ugly.
>
>Much simpler than that:
>
>  test -e foo. && echo found foo.
>
>The trailing dot excludes the .exe magic and is ignored on translation
>to windows filename.

...except on managed mounts, IIRC.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

