Re: date hashlist

David Haller <[email protected]> Sat, 9 Apr 2011 01:31:12 +0200
Newsgroups gmane.linux.suse.programming
Organization What?
Message-ID <[email protected]>
Hallo alter Scriptschmiedkollege,

Am Fri, 08 Apr 2011, Jan Trippler schrieb:

>Am Freitag, 8. April 2011, 17:22:08 schrieb Thomas Moritz:
>> Am Freitag, 8. April 2011 11:53:56 schrieb Bernhard Walle:
>[...]
>> > Ungetestet:
>> > TZ=3DGMT find /path/to/root -type f -exec touch -D "1970-01-01 00:00"
>> > {} \;
>
>Kleine Erg=E4nzung: Die -exec-Option ist nicht sehr ressourcenschonend, da=
 f=FCr=20
>jede Datei ein neuer Prozess geforkt wird. Au=DFerdem k=F6nnte es Probleme=
 bei=20
>Dateien mit Leer- oder Sonderzeichen im Namen geben (bin mir da aber nicht=
=20
>sicher).

'find ... -exec .. {} +' (und auch die Version mit ';') ist "sicher"
gg=FC. Leer- und anderer  Sonderzeichen. find =FCbergibt die Dateinamen
direkt beim 'exec' in char * argv[].

$ strace -f -eexecve -s 128 find . -type f -exec /bin/ls {} +
execve("/usr/bin/find", ["find", ".", "-type", "f", "-exec", "/bin/ls", "{}=
", "+"], [/* 130 vars */]) =3D 0
Process 24398 attached
Process 24397 suspended
[pid 24398] execve("/bin/ls", ["/bin/ls", "./a b", "./a\nb", "./b", "./a"],=
 [/* 130 vars */]) =3D 0
=2E/a  ./a?b  ./a b  ./b
Process 24397 resumed
Process 24398 detached
--- SIGCHLD (Child exited) @ 0 (0) ---

HTH,
-dnh

--=20
God must love the Common Man; He made so many of them.
                                   -- BSD fortune file