On Wednesday 01 July 2009 16:30:26 Peter Humphrey wrote:
> Hello list,
>
> Can anyone explain this to me?
>
> $ /bin/grep -r hmenu *html
> index.html:                     <div id="hmenu">
> master.html:                    <div id="hmenu">
> pictures.html:                  <div id="hmenu">

The star is evaluated /before/ grep is executed. Therefore, only files that are 
ending with html are searched recursively. If you had placed the files in a 
directory called blablahtml, then grep would have searched there.

> $ /bin/grep -r hmenu pages/*html
> pages/community.html:                   <div id="hmenu">
> pages/contacts.html:                    <div id="hmenu">
> pages/history.html:                     <div id="hmenu">
> pages/music.html:                       <div id="hmenu">
> pages/news.html:                        <div id="hmenu">
> pages/people.html:                      <div id="hmenu">
> pages/pictures.html:                    <div id="hmenu">
>
> Grep is clearly disobeying the recursion command. I started noticing this a
> few days ago, and it's making maintenance of this directory hard work.

No, you just did not tell it to search in the the directory pages. :)

HTH
Patrick

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to