title: Redirection unexpected /bin/sh: 1:
body: <p>I am receiving this error:</p>
  <pre><code>/bin/sh: 1: Syntax error: redirection unexpected
  Traceback (most recent call last):
    File &quot;vpntest.py&quot;, line 24, in &lt;module&gt;
      output = check_output(command, shell=True)
    File &quot;/usr/lib/python2.7/subprocess.py&quot;, line 223, in check_output
      raise CalledProcessError(retcode, cmd, output=output)
  subprocess.CalledProcessError: Command 'source /etc/openconnect/dsn-dsmc.conf; openconnect -b -u ${USER} --cafile=${CACERT} --certificate=${CERT} --sslkey=${KEY} ${HOST} &lt;&lt;&lt; $PASS;ping 8.8.8.8 -w 5; ip addr; echo $?' returned non-zero exit status 2
  </code></pre>
  <p>This is my code:</p>
  <pre><code>import subprocess
  import argparse
  import sys
  from subprocess import check_output
  
  
  def parse_args(argv):
      parser = argparse.ArgumentParser()
      parser.add_argument(&quot;-u&quot;, &quot;--user&quot;, action=&quot;store&quot;,
                          help=&quot;User for login&quot;,
                          dest=&quot;user&quot;)
      parser.add_argument(&quot;-p&quot;, &quot;--pwd&quot;, action=&quot;store&quot;,
                          help=&quot;Password&quot;,
                          dest=&quot;pwd&quot;)
      args = parser.parse_args()
      return args
  args = parse_args(sys.argv[1:])
  
  command = 'source /etc/openconnect/cfgfile.conf; openconnect -b -u ${USER} --cafile=${CACERT} --certificate=${CERT} --sslkey=${KEY} ${HOST} &lt;&lt;&lt; $PASS;ping 8.8.8.8 -w 5; ip addr; echo $?'
       
  output = check_output(command, shell=True)
  </code></pre>
  <p>I have tried changing:</p>
  <pre><code>command = 'source /etc/openconnect/cfgfile.conf; openconnect -b -u ${USER} --cafile=${CACERT} --certificate=${CERT} --sslkey=${KEY} ${HOST} &lt;&lt;&lt; $PASS;ping 8.8.8.8 -w 5; ip addr; echo $?'
  </code></pre>
  <p>for</p>
  <pre><code>command = '#!/bin/bash source /etc/openconnect/cfgfile.conf; openconnect -b -u ${USER} --cafile=${CACERT} --certificate=${CERT} --sslkey=${KEY} ${HOST} &lt;&lt;&lt; $PASS;ping 8.8.8.8 -w 5; ip addr; echo $?'
  </code></pre>
  <p>But when I try to print command or output, It does not show any results, just spaces.</p>