Popen Question

Ian ian.g.kelly at gmail.com
Mon Nov 8 12:57:08 EST 2010


On Nov 8, 2:43 am, m... at distorted.org.uk (Mark Wooding) wrote:
> > I don’t know what happens to the extra arguments, but they just seem
> > to be ignored if -c is specified.
>
> The argument to -c is taken as a shell script; the remaining arguments
> are made available as positional parameters to the script as usual (only
> starting with $0 rather than $1, for some unknown reason).

Perhaps this example better demonstrates what is going on:

>>> p = subprocess.Popen(['echo one $0 three $1 five', 'two', 'four'],
...                      shell=True)
one two three four five

Cheers,
Ian



More information about the Python-list mailing list