www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/04/02:53:01

Date: Tue, 4 Aug 1998 09:52:44 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Davin Max Pearson <d DOT pearson AT ext DOT canterbury DOT ac DOT nz>
cc: djgpp AT delorie DOT com
Subject: Re: Problem with find
In-Reply-To: <wk1zqxbz9f.fsf@wibble.zibble>
Message-ID: <Pine.SUN.3.91.980804095226.5924I-100000@is>
MIME-Version: 1.0

On 4 Aug 1998, Davin Max Pearson wrote:

> When I "CD" to a directory that does contain "*.cc" files, I then
> try the following variations of the find command, with the
> following results:

This is all expected behavior, please read the manuals of Findutils
and Bash, and sections 16.1 and 16.2 of the DJGPP FAQ list.

`find' needs to get the wildcard unaltered, since it wants to test
the name of every file it finds against that wildcard.  However, if
you don't quote the wildcards, they will be expanded by the DJGPP
startup code (or by Bash, if you run `find' from Bash), and `find'
gets a list of file names instead.

The best way to quote wildcards is to use '', like this:

    find . -name '*.cc'

This is the best because it works both from command.com and from Bash
on DOS/Windows, and also on Unix.  So if you get accustomed to this
quoting style, you keep your sanity on any platform.

Other quoting methods will fail in some cases.

> (4) From BASH:
> 
>         find . -name "*.cc"
> 
> doesn't work (paths must precede expression)

It does work for me.  Did you actually type this exact command line?

> (5) From BASH:
> 
>         find . -name "\*.cc"
> 
> does nothing.

That's because the backslash in "\*.cc" is taken as the root
directory.  Use either "*.cc" or \*.cc, and then it will work (it does
for me).

I suggest not to use `\' as the escape character, since the DJGPP
ports generally uses `\' as a directory separator, except before ' or
".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019