test -e cannot distinguish between foo and foo.exe

Volker Quetschke quetschke@scytek.de
Mon Dec 19 15:11:00 GMT 2005

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.



PGP/GPG key  (ID: 0x9F8A785D)  available  from  wwwkeys.de.pgp.net
key-fingerprint 550D F17E B082 A3E9 F913  9E53 3D35 C9BA 9F8A 785D
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20051219/abf31bc7/attachment.sig>

More information about the Cygwin mailing list