find syntax (was: LFS Version 6.2 - Chapter 7. Setting Up System Bootscripts...)

Mag. Leonhard Landrock 1977-Hamlet at gmx.at
Sat Aug 19 03:08:07 PDT 2006


Am Samstag, 19. August 2006 00:41 schrieb Brandon Peirce:
> Mag. Leonhard Landrock wrote:
> >Why does "find / -name syslogd -exec pwd ;" not work?
>
> You need to protect the last ; from the shell so it is passed
> as an argument to find, not seen as the end of the find command
> by the shell. You can choose \;  ";" or ';'

Thanks.

> BTW, the description of the -exec action in the find(1) man page
> specifically says: "Both of these constructions [ ; and {} ] might
> need to be escaped (with a `\') or quoted to protect them from
> expansion by the shell."

More thanks.

BTW: You are absolutely right with the man page. Don't know why I haven't  
seen that at once.

> Also BTW, the " -exec pwd \; " will always print just / because
> "The command is executed in the starting directory." That's taken
> from the same paragraph of the man page--but only in some
> versions of the man page I have on my box???
> You probably want:
> find / -name syslogd -exec dirname '{}' ';'

Yes, that's what I wanted. :-)

Once again: Thank you!

> - Brandon.
Leonhard.



More information about the lfs-support mailing list