J
jkn
Hi All
i am trying to build up a set of subprocess.Ponen calls to
replicate the effect of a horribly long shell command. I'm not clear
how I can do one part of this and wonder if anyone can advise. I'm on
Linux, fairly obviously.
I have a command which (simplified) is a tar -c command piped through
to xargs:
tar -czvf myfile.tgz -c $MYDIR mysubdir/ | xargs -I '{}' sh -c "test -
f $MYDIR/'{}'"
(The full command is more complicated than this; I got it from a shell
guru).
IIUC, when called like this, the two occurences of '{}' in the xargs
command will get replaced with the file being added to the tarfile.
Also IIUC, I will need two calls to subprocess.Popen() and use
subprocess.stdin on the second to receive the output from the first.
But how can I achive the substitution of the '{}' construction across
these two calls?
Apologies if I've made any howlers in this description - it's very
likely...
Cheers
J^n
i am trying to build up a set of subprocess.Ponen calls to
replicate the effect of a horribly long shell command. I'm not clear
how I can do one part of this and wonder if anyone can advise. I'm on
Linux, fairly obviously.
I have a command which (simplified) is a tar -c command piped through
to xargs:
tar -czvf myfile.tgz -c $MYDIR mysubdir/ | xargs -I '{}' sh -c "test -
f $MYDIR/'{}'"
(The full command is more complicated than this; I got it from a shell
guru).
IIUC, when called like this, the two occurences of '{}' in the xargs
command will get replaced with the file being added to the tarfile.
Also IIUC, I will need two calls to subprocess.Popen() and use
subprocess.stdin on the second to receive the output from the first.
But how can I achive the substitution of the '{}' construction across
these two calls?
Apologies if I've made any howlers in this description - it's very
likely...
Cheers
J^n