same behavior is observed with ash and hush: $ rm -rf a $ mkdir a $ touch a/f $ > */f sh: can't create */f: nonexistent directory
It's a bashism. bash does it only is you run it as "bash" # bash -c 'rm -rf www; mkdir www; touch www/test; echo Hey >ww*/test; echo $?' 0 # sh -c 'rm -rf www; mkdir www; touch www/test; echo Hey >ww*/test; echo $?' sh: ww*/test: No such file or directory 1 ash and hush do the same as "bash as sh": # ash -c 'rm -rf www; mkdir www; touch www/test; echo Hey >ww*/test; echo $?' ash: can't create ww*/test: nonexistent directory 1 # hush -c 'rm -rf www; mkdir www; touch www/test; echo Hey >ww*/test; echo $?' hush: can't open 'ww*/test': No such file or directory 1
my mistake, i thought path expansion was supposed to occur first