展開する必要があるスペースとグロブ文字 (*?) の両方を含むパターンに一致する Posix シェル スクリプト関数を作成したいと考えています。Python では、glob.glob('/tmp/hello world*')は正しいリストを返します。シェルでこれを行うにはどうすればよいですか?
#!/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*'