how to simulate tar filename substitution across piped subprocess.Popen() calls?

Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at spamschutz.glglgl.de
Tue Nov 13 16:36:47 EST 2012


Am 12.11.2012 19:30 schrieb Hans Mulder:

> This will break if there are spaces in the file name, or other
> characters meaningful to the shell.  If you change if to
>
>          xargsproc.append("test -f '%s/{}'&&  md5sum '%s/{}'"
>                               % (mydir, mydir))
>
> , then it will only break if there are single quotes in the file name.

And if you do mydir_q = mydir.replace("'", "'\\''") and use mydir_q, you 
should be safe...


Thomas



More information about the Python-list mailing list