Hallo, On Thu, 05 Jun 2003, Peter Wiersig wrote:
David Haller wrote:
On Thu, 05 Jun 2003, Peter Wiersig wrote:
tar cf test.tar -T <( echo -e "file1\nfile2" )
Letzeres wird nicht klappen, da du dem -T nicht sagst, aus welcher Datei es lesen soll.
Das macht die Shell. (Ausprobiert: Beide Fehlermeldungen sind die gleichen. ;)
Vorteil von '<( )': Man kann es oefter als einmal benutzen.
*HUCH*[tm] *g* Also, selbst wenn das mit "normalen" Dateinamen klappt, robust ist das nicht... ==== dh@slarty[1]: /tmp/test3 (0)$ ls -b1 a\tb b\\tc c\nd dh@slarty[1]: /tmp/test3 (0)$ cat * a b b\tc c d ## -> Inhalt == Dateiname ;) dh@slarty[1]: /tmp/test3 (0)$ tar cv -f test.tar -T <(echo *) tar: Cannot add file a b b c c: No such file or directory tar: Cannot add file d: No such file or directory tar: Error exit delayed from previous errors dh@slarty[1]: /tmp/test3 (2)$ $ tar cv -f test.tar -T <(echo -e 'a\tb'; echo 'b\tc') a\tb tar: Cannot add file b c: No such file or directory tar: Error exit delayed from previous errors $ tar cv -f test.tar -T <(echo -e 'a\tb'; echo 'b\\tc') a\tb b\\tc ==== Mit dem '\n' kommt tar aber so net klar. Was meist besser klappt: ==== $ find . -type f -print0 | tar cv -f test.tar --null -T - ==== Wie's scheint hat aber find oder tar mit dem '\' Probleme: ==== $ find . -type f -print0 | tar cv -f test.tar --null -T - ./a\tb tar: Cannot add file ./b c: No such file or directory ./c\nd tar: Error exit delayed from previous errors ==== Man beachte aber: 'c\nd' wird mit eingepackt... Warum tar beim '\\t' net will versteh ich auch net. find macht jedenfalls das richtige: ==== $ find . -type f -print0 | od -tx1 0000000 2e 2f 61 09 62 00 2e 2f 62 5c 74 63 00 2e 2f 63 0000020 0a 64 00 2e 2f 74 65 73 74 2e 74 61 72 00 0000036 ==== Hm. Jan? Hast du ne Idee? Is mein Tar zu alt? ==== $ tar --version | head -1 tar (GNU tar) 1.12 ==== -dnh --
Gehörst du auch zu den Leuten, die Ironie erst erkennen, wenn sie ihnen ein Loch ins Knie bohrt und Goldfische drin züchtet? [Sebastian Posner in dasr]