]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/glob5.sub
bash-5.1 distribution sources and documentation
[thirdparty/bash.git] / tests / glob5.sub
1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
5 #
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
10 #
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 #
14 ORIGD=$PWD
15 : ${TMPDIR:=/var/tmp}
16
17 SD=$TMPDIR/bash-glob-$$
18 [ -d $SD ] || mkdir $SD
19 builtin cd $SD || { echo "glob5.sub: cannot change directory to $SD" >&2 ; exit 1; }
20 mkdir tmp
21
22 D=./tmp/a
23 D1='./t\mp/a'
24
25 mkdir -m700 ./tmp/a ./tmp/a/b
26 touch ./tmp/a/b/c
27
28 echo ./tmp/a/b/* "./tmp/a/"b/* "./tmp/a/b"/*
29
30 chmod -r ./tmp/a
31 echo ./tmp/a/b/* "./tmp/a/"b/* "./tmp/a/b"/*
32 echo "./tmp/a/b"/*
33
34 bs=\\
35 echo ./tmp${bs}/a/b/*
36 echo ./tmp${bs}/a/b/c
37 echo ./tm[p]${bs}/a/b/c
38 echo ./t${bs}mp/a/b/*
39
40 recho "./tmp/a"/*
41 recho "$D"/*
42 recho "$D"/b/*
43
44 recho $D/*
45 recho $D/b/*
46 recho $D1/*
47 recho $D1/b/*
48 recho $D/
49 recho $D/b/
50 recho $D1/
51 recho $D1/b/
52
53 recho ./t\mp/a/*
54 recho ./t\mp/a/b/*
55
56 recho ./tmp/a*
57 recho ./tmp/a/b*
58 recho ./t\mp/a*
59 recho ./t\mp/a/b*
60
61 recho ./t\mp/
62
63 chmod +r ./tmp/a
64 rm -rf ./tmp/a
65
66 a='$foo'
67 b='$bar'
68 a=$(echo "$a" | sed 's/\$/\\$/g')
69
70 recho $a "$a"
71 recho 'mixed'$a/
72
73 unset a b
74
75 cd $ORIGD
76 rm -rf $SD