title: Wildcard not working in subprocess call using shlex
body: <p>Language: Python v2.6.2</p>
  
  <p>OS: AIX 5.3</p>
  
  <p>I'm using Python to restore some files from a backup to a test system - all commands are called in the manner below, however some just plain don't want to work.</p>
  
  <pre><code>#!/usr/bin/python
  import subprocess, shlex
  
  cmd = 'sudo rm -rf /work/TEST/*'
  arg = shlex.split(cmd)
  
  # This does not work
  p = subprocess.Popen(arg)
  
  # This, however, works just fine
  p = subprocess.Popen(cmd, shell=True)
  </code></pre>
  
  <p>If I remove the *'s from the commands they work fine (well, they work as they should without the wildcards, which is unfortauntely not what I want).</p>
  
  <p>I really do not want to use shell=True for obvious security reasons, however there are a couple of other commands that basically do the same thing. If there is a wildcard in the command it just won't work - it executes without error, just doesn't do anything.</p>
  
  <p>Interestingly the following command (parsed through shlex): </p>
  
  <pre><code>sudo mv /work/testrestore/production/* /work/TESTC
  </code></pre>
  
  <p>Produces the following:</p>
  
  <p>mv: 0653-401 Cannot rename /work/testrestore/production/* to /work/TESTC/*: A file or directory in the path name does not exist.</p>
  
  <p>It's as if unix is now trying to move a file named * rather then using * as a wildcard. Is this typical behaviour of shlex?</p>
  
  <p>Edit: I have tried escaping the * with a \, also tried changing from single quotes to double.. not that I expected that to do anything.</p>