2 # test the shell globbing
11 builtin cd $TESTDIR || { echo $0: cannot cd to $TESTDIR >&2 ; exit 1; }
14 touch a b c d abc abd abe bb bcd ca cb dd de
17 # see if `regular' globbing works right
18 expect '<a> <abc> <abd> <abe> <X*>'
21 expect '<a> <abc> <abd> <abe>'
24 # see if null glob expansion works
27 expect '<a> <abc> <abd> <abe>'
32 # see if the code that expands directories only works
36 # Test quoted and unquoted globbing characters
46 expect '<c> <ca> <cb> <a*> <*q*>'
61 # Pattern from Larry Wall's Configure that caused bash to blow up
62 expect '</^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/>'
63 recho "/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/"
65 # Make sure character classes work properly
67 expect '<abc> <abd> <abe> <bb> <cb>'
70 expect '<abd> <abe> <bb> <bcd> <bdir> <ca> <cb> <dd> <de>'
81 expect '<d> <dd> <de>'
84 # Make sure that filenames with embedded globbing characters are handled
105 *.\*) echo not there ;;
109 # examples from the Posix.2 spec (d11.2, p. 243)
168 # This is very odd, but sh and ksh seem to agree
179 touch man/man1/bash.1
180 expect '<man/man1/bash.1>'
182 expect '<man/man1/bash.1>'
183 recho $(echo */man*/bash.*)
184 expect '<man/man1/bash.1>'
185 recho "$(echo */man*/bash.*)"
187 # tests with multiple `*'s
193 a*****?c) echo ok 2;;
197 ?*****??) echo ok 3;;
205 *****??c) echo ok 5;;
209 ?*****?c) echo ok 6;;
213 ?***?****c) echo ok 7;;
217 ?***?****?) echo ok 8;;
221 ?***?****) echo ok 9;;
225 *******c) echo ok 10;;
229 *******?) echo ok 11;;
233 a*cd**?**??k) echo ok 20;;
237 a**?**cd**?**??k) echo ok 21;;
241 a**?**cd**?**??k***) echo ok 22;;
245 a**?**cd**?**??***k) echo ok 23;;
249 a**?**cd**?**??***k**) echo ok 24;;
253 a****c**?**??*****) echo ok 25;;
256 # none of these should output anything
259 ??**********?****?) echo bad ;;
263 ??**********?****c) echo bad ;;
267 ?************c****?****) echo bad;;
275 a*****c*?**) echo bad;;
279 a********???*******) echo bad;;