Output from subprocess.Popen()

Fredrik Lundh fredrik at pythonware.com
Mon Oct 16 23:31:21 CEST 2006


sjdevnull at yahoo.com wrote:

> I can't see any obvious way to ask subprocess to use a shell other than
> the default.

-c ?

 >>> f = Popen(["/bin/bash", "-c", "set|grep IFS"], stdout=PIPE)
 >>> f.stdout.read()
"IFS=$' \\t\\n'\n"
 >>> f = Popen(["/bin/sh", "-c", "set|grep IFS"], stdout=PIPE)
 >>> f.stdout.read()
"IFS=' \t\n"

</F>




More information about the Python-list mailing list