]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/glob5.sub
Bash-5.2-rc4 release
[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 [ $UID -eq 0 ] && { echo "glob5.sub: the test suite should not be run as root" >&2 ; }
15
16 ORIGD=$PWD
17 : ${TMPDIR:=/var/tmp}
18
19 SD=$TMPDIR/bash-glob-$$
20 [ -d $SD ] || mkdir $SD
21 builtin cd $SD || { echo "glob5.sub: cannot change directory to $SD" >&2 ; exit 1; }
22 mkdir tmp
23
24 D=./tmp/a
25 D1='./t\mp/a'
26
27 mkdir -m700 ./tmp/a ./tmp/a/b
28 touch ./tmp/a/b/c
29
30 echo ./tmp/a/b/* "./tmp/a/"b/* "./tmp/a/b"/*
31
32 chmod -r ./tmp/a
33 echo ./tmp/a/b/* "./tmp/a/"b/* "./tmp/a/b"/*
34 echo "./tmp/a/b"/*
35
36 bs=\\
37 echo ./tmp${bs}/a/b/*
38 echo ./tmp${bs}/a/b/c
39 echo ./tm[p]${bs}/a/b/c
40 echo ./t${bs}mp/a/b/*
41
42 recho "./tmp/a"/*
43 recho "$D"/*
44 recho "$D"/b/*
45
46 recho $D/*
47 recho $D/b/*
48 recho $D1/*
49 recho $D1/b/*
50 recho $D/
51 recho $D/b/
52 recho $D1/
53 recho $D1/b/
54
55 recho ./t\mp/a/*
56 recho ./t\mp/a/b/*
57
58 recho ./tmp/a*
59 recho ./tmp/a/b*
60 recho ./t\mp/a*
61 recho ./t\mp/a/b*
62
63 recho ./t\mp/
64
65 chmod +r ./tmp/a
66 rm -rf ./tmp/a
67
68 a='$foo'
69 b='$bar'
70 a=$(echo "$a" | sed 's/\$/\\$/g')
71
72 recho $a "$a"
73 recho 'mixed'$a/
74
75 unset a b
76
77 cd $ORIGD
78 rm -rf $SD