From 86a0bc9ed3d6bc493950575cea8d94e6f6e41cbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Tue, 14 Nov 2023 20:50:17 +0000 Subject: [PATCH] syntax: support brace expansions with uppercase letters They clearly work in Bash: $ echo test{A..C} testA testB testC Updates #1042. --- expand/braces_test.go | 4 ++++ syntax/braces.go | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/expand/braces_test.go b/expand/braces_test.go index 4743cbe1..2ae4d27d 100644 --- a/expand/braces_test.go +++ b/expand/braces_test.go @@ -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}"), diff --git a/syntax/braces.go b/syntax/braces.go index f3452819..94c64ea8 100644 --- a/syntax/braces.go +++ b/syntax/braces.go @@ -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