Popen Question

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Mon Nov 8 03:06:43 EST 2010


In message <ib0kor015nt at news5.newsguy.com>, Chris Torek wrote:

>     ['/bin/sh', '-c', 'echo', '$MYVAR']
> 
> (with arguments expressed as a Python list).  /bin/sh takes the
> string after '-c' as a command, and the remaining argument(s) if
> any are assigned to positional parameters ($0, $1, etc).

Doesn’t work. I don’t know what happens to the extra arguments, but they 
just seem to be ignored if -c is specified.

    sh -c 'echo hi'

echoes “hi”, while

    sh -c echo hi

just outputs a blank line.



More information about the Python-list mailing list