How to use "-name *.c" with find?

How to use "-name *.c" with find?

Post by Jonathan Kame » Tue, 26 Mar 1996 04:00:00




|> When I use the program find like this:
|>
|> find / -name *.c -print
|> --OR--
|> find / -name * -print
|>
|> I sometimes get a error message that says `path must preceed
|> expression. I guess it has something to do with the `*.c part.
|>
|> How should I format the command so that it will understand what I
|> want?

You should put the wildcard expressions in quotes, so that they are
interpreted by find (which is what you want) rather than by the shell (which
is not what you want):

        find / -name "*.c" -print
        find / -name "*" -print

Followups directed to comp.unix.questions.

 
 
 

How to use "-name *.c" with find?

Post by Simon Benne » Wed, 03 Apr 1996 04:00:00



: |> When I use the program find like this:
: |>
: |> find / -name *.c -print
: |> --OR--
: |> find / -name * -print
: |>
: |> I sometimes get a error message that says `path must preceed
: |> expression. I guess it has something to do with the `*.c part.
: |>
: |> How should I format the command so that it will understand what I
: |> want?

: You should put the wildcard expressions in quotes, so that they are
: interpreted by find (which is what you want) rather than by the shell (which
: is not what you want):

:       find / -name "*.c" -print
:       find / -name "*" -print

: Followups directed to comp.unix.questions.

The following will also work

find / -name \*.c -print

The result is the same in that the * is "protected" from the shell.

--
+----------------------------------------------------------------------------+

  Wormald Technology  Advanced Systems Engineering Ph: +61 2 9981 0611 (x512)

                        Common Sense doesn't seem to be

 
 
 

1. How to use "-name *.c" with find?

When I use the program find like this:

find / -name *.c -print
--OR--
find / -name * -print

I sometimes get a error message that says `path must preceed
expression. I guess it has something to do with the `*.c part.

How should I format the command so that it will understand what I
want?

--

"Windows 95: from the guys who brought you EDLIN"

2. SCSI timeout during install.... :-(

3. ***NYC***UNIX "C" and VAX "C" Programer/Analysts $75K-85K

4. Platform specific variable for use in #ifdefs

5. CVSup on AIX?

6. ***NYC***UNIX "C" and VAX "C" Programer/Analysts

7. mod_rewrite- Redirecting w/o changing URL?

8. How to convert "A+B+C" into "A B C" in C shell (sh)?

9. ***NYC***UNIX "C" and VAX "C" Programer/Analysts $75K-85K

10. using "find" with multiple -name patterns???

11. named: "found it", ping: "unknown host"

12. Trap "^C" "^Z" and "^\"