1 |
On Wednesday 01 July 2009 16:30:26 Peter Humphrey wrote: |
2 |
> Hello list, |
3 |
> |
4 |
> Can anyone explain this to me? |
5 |
> |
6 |
> $ /bin/grep -r hmenu *html |
7 |
> index.html: <div id="hmenu"> |
8 |
> master.html: <div id="hmenu"> |
9 |
> pictures.html: <div id="hmenu"> |
10 |
|
11 |
The star is evaluated /before/ grep is executed. Therefore, only files that are |
12 |
ending with html are searched recursively. If you had placed the files in a |
13 |
directory called blablahtml, then grep would have searched there. |
14 |
|
15 |
> $ /bin/grep -r hmenu pages/*html |
16 |
> pages/community.html: <div id="hmenu"> |
17 |
> pages/contacts.html: <div id="hmenu"> |
18 |
> pages/history.html: <div id="hmenu"> |
19 |
> pages/music.html: <div id="hmenu"> |
20 |
> pages/news.html: <div id="hmenu"> |
21 |
> pages/people.html: <div id="hmenu"> |
22 |
> pages/pictures.html: <div id="hmenu"> |
23 |
> |
24 |
> Grep is clearly disobeying the recursion command. I started noticing this a |
25 |
> few days ago, and it's making maintenance of this directory hard work. |
26 |
|
27 |
No, you just did not tell it to search in the the directory pages. :) |
28 |
|
29 |
HTH |
30 |
Patrick |