[unix-ws] -exec vs. execdir

Jan Bruners lists at bruners.de
Son Mar 2 19:47:42 CET 2003


Hallo,

vor kurzem habe ich die "find"-Option -execdir entdeckt. Mir ist allerdings nicht ganz klar, welchen Effekt sie hat (im Vergleich zu -exec). Die manpage erläutert:

-exec utility [argument ...];
[...]
 Utility will be executed from the directory from which find was
 executed.  Utility and arguments are not subject to the further
 expansion of shell patterns and constructs.

-execdir utility [argument ...];
 The -execdir primary is identical to the -exec primary with the
 exception that utility will be executed from the directory that
 holds the current file.
 
 Nun könnte man meinen, dass der Output des durch -execdir aufgerufenen Programms im Verzeichnis des Arguments landet, der Output von -exec dagegen im Verzeichnis, von dem aus find gestartet wurde. Dieser Unterschied zeigt sich auf meinem System allerdings nicht (Mac OS X 10.2.4).

Ein Kollege mit einem ähnlichen System hat allerdings genau diesen Unterschied konstatiert. Gibt es dafür vielleicht eine schlüssige Erklärung?

Freundliche Grüße

Jan Bruners