This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: empty directory globbing in bash/sh for loops

Hash: SHA1

According to on 3/2/2006 6:10 AM:
> In the Cygwin bash the following statement
> for file in ./SOME_EMPTY_DIR/* ; do do_it_on $file ; done
> executes the following once because of how globbing is done.
> do_it_on ./SOME_EMPTY_DIR/*

Correct - POSIX requires that.  However, bash also has the 'shopt -s
nullglob' which may help in your situation.

> Unfortunately the gcc 4.0.2 makefiles do use this on possibly empty
> directories and break.
> Does anybody know how to solve this, please?

If it hurts, don't do it.  Report the bug to the gcc folks, if they aren't
being robust enough to protect against an empty directory.

> Unless stated above to be non-confidential, this E-mail and any 
> attachments are private and confidential and are for the addressee 
> only and may not be used, copied or disclosed save to the addressee.

Oops - not anymore.  Please don't send email to publicly archived mailing
lists with unenforceable legalese trash at the bottom (open up a free
web-based account, if necessary).

- --
Life is short - so eat dessert first!

Eric Blake   
volunteer cygwin bash maintainer
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]