X-Spam-Check-By: sourceware.org From: ericblake AT comcast DOT net (Eric Blake) To: Andrew DeFaria , cygwin AT cygwin DOT com Subject: Re: Inconsistency in find ... -name ... Date: Tue, 16 May 2006 11:37:20 +0000 Message-Id: <051620061137.29527.4469B970000106240000735722070208530A050E040D0C079D0A@comcast.net> X-Mailer: AT&T Message Center Version 1 (Apr 11 2006) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com > > And notice that since there are no .h files in the current > > directory, the shell passes the glob through unchanged > > to find. You can also do 'shopt -s nullglob' to change that. > I've wondered about this. Does bash special case the find command then? > Which other commands does is special case like this? The nullglob shell option just tells bash that if a glob does not match any file name, remove the argument altogether instead of passing the glob through as though it had been quoted. Nothing about that is find-specific; although in the case of 'find . -name *.pl', where there are no .pl files in the current directory, with nullglob unset it finds *.pl files in subdirectories, but with nullglob set, it is a syntax error. Bash does not special case find, or any other command, unless you write an alias or function in the environment to tell bash how to special case it. See my previous email for an idea how you use an alias (which is expanded prior to globbing, and hence can temporarily supress globbing), combined with a function (the alias can only work left-to-right, but by sticking a function in the middle, you can use the function to rearrange when things happen) in order to give find special treatment so that you can use find with globbing supressed. And be aware that my suggested alias is not perfect (think exit codes, among other things); google will show you more complex examples of the same idea. But none of it is cygwin specific, and by default, bash globs everything that looks like a glob and is not quoted, whether or not you intended for the glob to be passed through literally. -- Eric Blake -- 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/