Failed to run shell commands with subprocess
<p>In my terminal if I run: <code>echo $(pwd)</code>, I got <code>/home/abr/workspace</code>, but when I tried to run this script in python like this: </p>

<pre><code>&gt;&gt;&gt; import subprocess
&gt;&gt;&gt; cmd = ['echo', '$(pwd)']
&gt;&gt;&gt; subprocess.check_output(cmd, shell=True)
</code></pre>

<p>I get <code>'\n'</code>. How to fix this?</p>