title: shell glob expansion with spaces
body: <p>I'd like to write a Posix shell script function that will match on a pattern with both spaces and glob characters (*?) that need to be expanded.  In Python, <em>glob.glob('/tmp/hello world*')</em> will return the correct list.  How do I do this in the shell?</p>
  
  <pre><code>#!/bin/sh
  
  ## this function will list
  ## all of the files in the /tmp
  ## directory that match pattern
  f() {
    PATTERN="$1"
    ls -1 "/tmp/$PATTERN"
  }
  
  touch '/tmp/hello world {1,2,3}.txt'
  f 'hello world*'
  </code></pre>