KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
If I run echo a; echo b in bash the result will be that both commands are run. However if I use subprocess then the first command is run, printing out the whole of the rest of the line. The code below echos a; echo b instead of a b , how do I get it to run both commands? import subprocess, shlex def subprocess_cmd(command): process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE) proc_stdout = process.communicate()[0].strip() print proc_stdout subprocess_cmd("echo a; echo b")
Tags (comma-separated)
Save Edits
Cancel