Andreas: Einen Linux Konsolenbefehl erklären

Beitrag lesen

Hallo!

ich bin auch kein Fachman, was ich aus man find schließe:

find . -type d -exec touch "{}"/.xmhcache ;

find
der Kommandozeilen Befehl -> also man find nachgucken

.
steht vermutlich für den Pfad, also aktuelles Verzeichnis

-type d
heißt nur Verzeichnisse finden

-exec
heißt einen Kommandozeilenbefehl ausführen

touch
der auszuführende Kommandozeilenbefehl -> man touch
wenn ich das nicht ganz falsch verstehe wird hier die Datei .xmhcache angelegt wenn sie nichtz existiert, sonst mit dem aktuellen Timestamp versehen. "{}"/ steht so wie ich das versthe für das aktuelle Verzeichnis, was das \ am Ende escapen soll verstehe ich aber nicht mehr.

Vermutlich steht die Lösung hier, aber ich verstehe es nicht 100%ig:

-exec command ;
              Execute command; true if 0 status is returned.  All
              following arguments to find are taken to  be  argu-
              ments  to  the command until an argument consisting
              of ;' is encountered.  The string {}' is replaced
              by the current file name being processed everywhere
              it occurs in the arguments to the command, not just
              in arguments where it is alone, as in some versions
              of find.  Both of these constructions might need to
              be  escaped  (with a `') or quoted to protect them
              from expansion by the shell.  The command  is  exe-
              cuted in the starting directory.

Wenn das ganze rekursiv laufen soll, versuch es mal mit der option -depth, aber sicher bin ich nicht. Das können Dir aber andere sicher besser sagen!

Grüße
Andreas