Ian wrote:
On Nov 8, 2:43 am, m...@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
Maybe I'm thick, but I still don't understand. If I run a shell script,
then the name of the script is in $0 and the first positional arguments
is in $1, similar to how Python sets up sys.argv.
But in this case the first positional argument is in $0. Why is that?
Puzzled,
-- HansM
--
http://mail.python.org/mailman/listinfo/python-list