[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange results executing the find command.
From: |
Andreas Metzler |
Subject: |
Re: Strange results executing the find command. |
Date: |
Wed, 22 Dec 2004 08:38:45 +0100 |
User-agent: |
Mutt/1.5.6+20040907i |
On 2004-12-22 Michel Bouchet <address@hidden> wrote:
[...]
> - I am in a folder, with a subfolder called "reviews".
> - When I execute the command "ls reviews/*.php"; I can see two files :
> "reviews/nav.php" and "reviews/nav1.php".
> - When I execute the command "find reviews -name *.php"; I can only see one
> file :
> "reviews/nav.php".
> - I wonder why the "find" command does not also show the file "reviews/nav1.
> php".
> Is this a bug ? Or am I making a mistake ?
Hello,
You are probably making a mistake. You are not protecting "*.php" from
expansion by the shell, so if there exists a file named nav.php in the
*current* directory and you type
find reviews -name *.php
your shell expands *.php and find gets to see
find reviews -name nav.php
(Easily verifyable with echo find reviews -name *.php)
Use single-quotes to protect the wildcards from shell expansion:
find reviews -name '*.php'
cu andreas
--
"See, I told you they'd listen to Reason," [SPOILER] Svfurlr fnlf,
fuhggvat qbja gur juveyvat tha.
Neal Stephenson in "Snow Crash"
http://downhill.aus.cc/