Python - Wie nennen bash-Befehlen mit pipe?

Kann ich dies in der Regel auf der Kommandozeile in Linux:

$ tar c my_dir | md5sum

Aber wenn ich versuche, rufen Sie es mit Python bekomme ich eine Fehlermeldung:

>>> subprocess.Popen(['tar','-c','my_dir','|','md5sum'],shell=True)
<subprocess.Popen object at 0x26c0550>
>>> tar: You must specify one of the `-Acdtrux' or `--test-label'  options
Try `tar --help' or `tar --usage' for more information.
  • Warum sind Sie hashing eine tar-Datei? Meinst du auf der Suche nach Veränderungen im Inhalt der Datei? oder überprüfen, ob eine extern erstellte tar-Datei?
InformationsquelleAutor Greg | 2011-09-06
Schreibe einen Kommentar