Newsgroups: comp.lang.python
From: Hans Mulder <han...@xs4all.nl>
Date: Mon, 12 Nov 2012 17:35:43 +0100
Local: Mon, Nov 12 2012 11:35 am
Subject: Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?
On 12/11/12 16:36:58, jkn wrote:
> slight followup ...
It is not really necessary to translate the '&&': you can
> I have made some progress; for now I'm using subprocess.communicate to
> The reason 'we' weren't seeing any output from the second call (the
> "xargs -I {} sh -c \"test -f %s/{} && md5sum %s/{}\"" % (mydir, mydir)
> ie. I am running md5sum on each tar-file entry which passes the 'is
> My next problem; how to translate the command-string clause
> "test -f %s/{} && md5sum %s/{}" # ...
> into s parameter to subprocss.Popen(). I think it's the command
just write: "test -f '%s/{}' && md5sum '%s/{}'" % (mydir, mydir)
, and xargs will pass that to the shell, and then the shell
Alternatively, you could translate it as:
"if [ -f '%s/{}' ]; then md5sum '%s/{}'; fi" % (mydir, mydir)
; that might make the intent clearer to whoever gets to
Hope this helps,
-- HansM
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||