Skip to content

Commit

Permalink
syntax: support brace expansions with uppercase letters
Browse files Browse the repository at this point in the history
They clearly work in Bash:

    $ echo test{A..C}
    testA testB testC

Updates #1042.
  • Loading branch information
mvdan committed Nov 14, 2023
1 parent 8b67386 commit 86a0bc9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions expand/braces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ var braceTests = []struct {
litWord("a{c..f}"),
litWords("ac", "ad", "ae", "af"),
},
{
litWord("a{H..K}"),
litWords("aH", "aI", "aJ", "aK"),
},
{
litWord("a{-..f}"),
litWords("a{-..f}"),
Expand Down
3 changes: 2 additions & 1 deletion syntax/braces.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ func SplitBraces(word *Word) bool {
val := elem.Lit()
if _, err := strconv.Atoi(val); err == nil {
} else if len(val) == 1 &&
'a' <= val[0] && val[0] <= 'z' {
(('a' <= val[0] && val[0] <= 'z') ||
('A' <= val[0] && val[0] <= 'Z')) {
chars[i] = true
} else {
broken = true
Expand Down

0 comments on commit 86a0bc9

Please sign in to comment.