How do subprocess.Popen("ls | grep foo", shell=True) with shell=False?

Grant Edwards invalid at invalid.invalid
Thu Jun 10 10:04:56 EDT 2010


On 2010-06-10, Chris Seberino <cseberino at gmail.com> wrote:

> How do subprocess.Popen("ls | grep foo", shell=True) with shell=False?

You'll have to build your own pipeline with multiple calls to subprocess

> Does complex commands with "|" in them mandate shell=True?

Yes.

Hey, I've got a novel idea!

Read the documentation for the subprocess module:

http://docs.python.org/library/subprocess.html#replacing-shell-pipeline

-- 
Grant Edwards               grant.b.edwards        Yow! ... My pants just went
                                  at               on a wild rampage through a
                              gmail.com            Long Island Bowling Alley!!



More information about the Python-list mailing list