mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-16 10:03:08 -07:00
Add handling for special characters in parameter substitutions.
Fixes koalaman/shellcheck#562. Special characters inside braces are parsed into T_ParamSubSpecialChar instead of T_Literal so that they are not flagged in the function checkInexplicablyUnquoted when sandwiched between double quotes.
This commit is contained in:
parent
9703f89f79
commit
0897ab7092
3 changed files with 13 additions and 2 deletions
|
@ -111,6 +111,7 @@ data Token =
|
|||
| T_NormalWord Id [Token]
|
||||
| T_OR_IF Id
|
||||
| T_OrIf Id (Token) (Token)
|
||||
| T_ParamSubSpecialChar Id -- e.g. '%' in ${foo%bar} or '/' in ${foo/bar/baz}
|
||||
| T_Pipeline Id [Token] [Token] -- [Pipe separators] [Commands]
|
||||
| T_ProcSub Id String [Token]
|
||||
| T_Rbrace Id
|
||||
|
@ -319,6 +320,7 @@ getId t = case t of
|
|||
T_DollarBraced id _ -> id
|
||||
T_DollarArithmetic id _ -> id
|
||||
T_BraceExpansion id _ -> id
|
||||
T_ParamSubSpecialChar id -> id
|
||||
T_DollarBraceCommandExpansion id _ -> id
|
||||
T_IoFile id _ _ -> id
|
||||
T_IoDuplicate id _ _ -> id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue