Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80556 views
1
# skip quotes for now
2
# "{x,x}"
3
# {"x,x"}
4
# {x","x}
5
# '{a,b}{{a,b},a,b}'
6
A{b,{d,e},{f,g}}Z
7
PRE-{a,b}{{a,b},a,b}-POST
8
\\{a,b}{{a,b},a,b}
9
{{a,b}
10
{a,b}}
11
{,}
12
a{,}
13
{,}b
14
a{,}b
15
a{b}c
16
a{1..5}b
17
a{01..5}b
18
a{-01..5}b
19
a{-01..5..3}b
20
a{001..9}b
21
a{b,c{d,e},{f,g}h}x{y,z
22
a{b,c{d,e},{f,g}h}x{y,z\\}
23
a{b,c{d,e},{f,g}h}x{y,z}
24
a{b{c{d,e}f{x,y{{g}h
25
a{b{c{d,e}f{x,y{}g}h
26
a{b{c{d,e}f{x,y}}g}h
27
a{b{c{d,e}f}g}h
28
a{{x,y},z}b
29
f{x,y{g,z}}h
30
f{x,y{{g,z}}h
31
f{x,y{{g,z}}h}
32
f{x,y{{g}h
33
f{x,y{{g}}h
34
f{x,y{}g}h
35
z{a,b{,c}d
36
z{a,b},c}d
37
{-01..5}
38
{-05..100..5}
39
{-05..100}
40
{0..5..2}
41
{0001..05..2}
42
{0001..-5..2}
43
{0001..-5..-2}
44
{0001..5..-2}
45
{01..5}
46
{1..05}
47
{1..05..3}
48
{05..100}
49
{0a..0z}
50
{a,b\\}c,d}
51
{a,b{c,d}
52
{a,b}c,d}
53
{a..F}
54
{A..f}
55
{a..Z}
56
{A..z}
57
{z..A}
58
{Z..a}
59
{a..F..2}
60
{A..f..02}
61
{a..Z..5}
62
d{a..Z..5}b
63
{A..z..10}
64
{z..A..-2}
65
{Z..a..20}
66
{a{,b}
67
{a},b}
68
{x,y{,}g}
69
{x,y{}g}
70
{{a,b}
71
{{a,b},c}
72
{{a,b}c}
73
{{a,b},}
74
X{{a,b},}X
75
{{a,b},}c
76
{{a,b}.}
77
{{a,b}}
78
X{a..#}X
79
# this next one is an empty string
80
81
{-10..00}
82
# Need to escape slashes in here for reasons i guess.
83
{a,\\\\{a,b}c}
84
{a,\\{a,b}c}
85
a,\\{b,c}
86
{-10.\\.00}
87
#### bash tests/braces.tests
88
# Note that some tests are edited out because some features of
89
# bash are intentionally not supported in this brace expander.
90
ff{c,b,a}
91
f{d,e,f}g
92
{l,n,m}xyz
93
{abc\\,def}
94
{abc}
95
{x\\,y,\\{abc\\},trie}
96
# not impementing back-ticks obviously
97
# XXXX\\{`echo a b c | tr ' ' ','`\\}
98
{}
99
# We only ever have to worry about parsing a single argument,
100
# not a command line, so spaces have a different meaning than bash.
101
# { }
102
}
103
{
104
abcd{efgh
105
# spaces
106
# foo {1,2} bar
107
# not impementing back-ticks obviously
108
# `zecho foo {1,2} bar`
109
# $(zecho foo {1,2} bar)
110
# ${var} is not a variable here, like it is in bash. omit.
111
# foo{bar,${var}.}
112
# foo{bar,${var}}
113
# isaacs: skip quotes for now
114
# "${var}"{x,y}
115
# $var{x,y}
116
# ${var}{x,y}
117
# new sequence brace operators
118
{1..10}
119
# this doesn't work yet
120
{0..10,braces}
121
# but this does
122
{{0..10},braces}
123
x{{0..10},braces}y
124
{3..3}
125
x{3..3}y
126
{10..1}
127
{10..1}y
128
x{10..1}y
129
{a..f}
130
{f..a}
131
{a..A}
132
{A..a}
133
{f..f}
134
# mixes are incorrectly-formed brace expansions
135
{1..f}
136
{f..1}
137
# spaces
138
# 0{1..9} {10..20}
139
# do negative numbers work?
140
{-1..-10}
141
{-20..0}
142
# weirdly-formed brace expansions -- fixed in post-bash-3.1
143
a-{b{d,e}}-c
144
a-{bdef-{g,i}-c
145
# isaacs: skip quotes for now
146
# {"klklkl"}{1,2,3}
147
# isaacs: this is a valid test, though
148
{klklkl}{1,2,3}
149
# {"x,x"}
150
{1..10..2}
151
{-1..-10..2}
152
{-1..-10..-2}
153
{10..1..-2}
154
{10..1..2}
155
{1..20..2}
156
{1..20..20}
157
{100..0..5}
158
{100..0..-5}
159
{a..z}
160
{a..z..2}
161
{z..a..-2}
162
# make sure brace expansion handles ints > 2**31 - 1 using intmax_t
163
{2147483645..2147483649}
164
# unwanted zero-padding -- fixed post-bash-4.0
165
{10..0..2}
166
{10..0..-2}
167
{-50..-0..5}
168
# bad
169
{1..10.f}
170
{1..ff}
171
{1..10..ff}
172
{1.20..2}
173
{1..20..f2}
174
{1..20..2f}
175
{1..2f..2}
176
{1..ff..2}
177
{1..ff}
178
{1..f}
179
{1..0f}
180
{1..10f}
181
{1..10.f}
182
{1..10.f}
183
184