I cannot get it it\'s bash related or python subprocess, but results are different:
>>> subprocess.Popen(\"echo $HOME\", shell=True, stdout=subproce
When you have shell=True
, actual process that runs is the shell process i.e., think of it running /bin/sh -c
on unix. The arguments you pass to Popen are passed as arguments to this shell process. So /bin/sh -c 'echo' '$HOME'
prints newline and the second argument is ignored. So usually you should only use string arguments with shell=True
.