]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/globstar2.sub
bash-5.0 distribution sources and documentation
[thirdparty/bash.git] / tests / globstar2.sub
1 olddir=$PWD
2 : ${TMPDIR:=/var/tmp}
3 EMPTY=$TMPDIR/empty
4
5 shopt -s globstar
6 s()
7 {
8 printf '== <%s> ==\n' "$@"
9 }
10 p()
11 {
12 printf '<%q>\n' "$@"
13 }
14
15 mkdir -p $EMPTY/a/a/a
16 cd $EMPTY
17
18 # good
19 p **
20 p **/**
21 p **/**/**
22
23 rm -rf a
24 mkdir -p $EMPTY/{a,b}/{a,b}/{a,b}/{a,b}
25 cd $EMPTY
26
27 # good
28 s '**/a'
29 p **/a
30
31 # good
32 s 'a/**'
33 p a/**
34
35 # good
36 s '**'
37 p **
38
39 # good
40 s '**/**'
41 p **/**
42
43 # good
44 s '**/**/**'
45 p **/**/**
46
47 # good
48 s '**/**/**/**/**'
49 p **/**/**/**/**
50
51 # good
52 s '**/**/a'
53 p **/**/a
54
55 # good
56 s 'a/**/**'
57 p a/**/**
58
59 # good
60 s 'a/**/**/**'
61 p a/**/**/**
62
63 # good
64 s 'a/**/**/**/**'
65 p a/**/**/**/**
66
67 # same as ksh93
68 s '**/a/**'
69 p **/a/**
70
71 # same as ksh93
72 s '**/a/**/**'
73 p **/a/**/**
74
75 # same as ksh93
76 s '**/a/**/**/**'
77 p **/a/**/**/**
78
79 # good
80 s '**/**/a/**'
81 p **/**/a/**
82
83 cd "$olddir"
84 rm -rf $EMPTY