summaryrefslogtreecommitdiffstats
path: root/tests/braces.tests
blob: da0b624bce1b2542f23ef4dd01797a8c3af5c8b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
echo ff{c,b,a}
echo f{d,e,f}g
echo {l,n,m}xyz
echo {abc\,def}
echo {abc}

echo \{a,b,c,d,e}
echo {x,y,\{a,b,c}}
echo {x\,y,\{abc\},trie}

echo /usr/{ucb/{ex,edit},lib/{ex,how_ex}}

echo XXXX\{`echo a b c | tr ' ' ','`\}
eval echo XXXX\{`echo a b c | tr ' ' ','`\}

echo {}
echo { }
echo }
echo {
echo abcd{efgh

echo foo {1,2} bar
echo `zecho foo {1,2} bar`
echo $(zecho foo {1,2} bar)

var=baz
varx=vx
vary=vy

echo foo{bar,${var}.}
echo foo{bar,${var}}

echo "${var}"{x,y}
echo $var{x,y}
echo ${var}{x,y}

unset var varx vary

# new sequence brace operators
echo {1..10}

# this doesn't work yet
echo {0..10,braces}
# but this does
echo {{0..10},braces}
echo x{{0..10},braces}y

echo {3..3}
echo x{3..3}y
echo {10..1}
echo {10..1}y
echo x{10..1}y

echo {a..f}
echo {f..a}

echo {a..A}
echo {A..a}

echo {f..f}

# mixes are incorrectly-formed brace expansions
echo {1..f}
echo {f..1}

echo 0{1..9} {10..20}

# do negative numbers work?
echo {-1..-10}
echo {-20..0}

# weirdly-formed brace expansions -- fixed in post-bash-3.1
echo a-{b{d,e}}-c

echo a-{bdef-{g,i}-c

echo {"klklkl"}{1,2,3}
echo {"x,x"}

echo {1..10..2}
echo {-1..-10..2}
echo {-1..-10..-2}

echo {10..1..-2}
echo {10..1..2}

echo {1..20..2}
echo {1..20..20}

echo {100..0..5}
echo {100..0..-5}

echo {a..z}
echo {a..z..2}
echo {z..a..-2}

# make sure brace expansion handles ints > 2**31 - 1 using intmax_t
echo {2147483645..2147483649}

# unwanted zero-padding -- fixed post-bash-4.0
echo {10..0..2}
echo {10..0..-2}
echo {-50..-0..5}

# bad
echo {1..10.f}
echo {1..ff}
echo {1..10..ff}
echo {1.20..2}
echo {1..20..f2}
echo {1..20..2f}
echo {1..2f..2}
echo {1..ff..2}
echo {1..ff}
echo {1..f}
echo {1..0f}
echo {1..10f}
echo {1..10.f}
echo {1..10.f}