title: Popen fails if command is a list and contains '&&' or '||'
body: <p>I have a python script that is running linux command to check if file exist:</p>
  
  <pre><code>&gt;&gt;&gt; p = subprocess.Popen([ 'sudo', 'test', '-f', '/root/some_file', '&amp;&amp;', 'echo', 'True', '||', 'echo', 'False' ])
  </code></pre>
  
  <p>It produces error:</p>
  
  <pre><code>&gt;&gt;&gt; test: extra argument `&amp;&amp;'
  </code></pre>
  
  <p>If pass the command as a single then it executes successfully:</p>
  
  <pre><code>&gt;&gt;&gt; p = subprocess.Popen('sudo test -f /root/some_file &amp;&amp; echo True || echo False' ], shell=True)
  &gt;&gt;&gt; True
  </code></pre>
  
  <p>Why does it fail if pass command as a list?</p>
  
  <p>I have to use both &amp;&amp; and || to check if the root's file exist so I can't convert it to the chain of separate commands as suggested <a href="https://stackoverflow.com/questions/15467237/using-in-subprocess-popen-for-command-chaining">here</a></p>