mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-16 10:03:08 -07:00
Fixed broken recursive backtick expansion.
This commit is contained in:
parent
8055b6f9c5
commit
d04262c70f
2 changed files with 7 additions and 1 deletions
|
@ -672,7 +672,7 @@ readBackTicked = called "backtick expansion" $ do
|
|||
subStart <- getPosition
|
||||
subString <- readGenericLiteral (char '`')
|
||||
char '`'
|
||||
result <- subParse subStart readCompoundList subString
|
||||
result <- subParse subStart readCompoundList (unEscape subString)
|
||||
return $ T_Backticked id result
|
||||
where
|
||||
-- Position may be off due to escapes
|
||||
|
@ -685,6 +685,11 @@ readBackTicked = called "backtick expansion" $ do
|
|||
setInput lastInput
|
||||
setPosition lastPosition
|
||||
return result
|
||||
unEscape [] = []
|
||||
unEscape ('\\':x:rest) | x `elem` "\"$`\\" = x : unEscape rest
|
||||
unEscape ('\\':'\n':rest) = unEscape rest
|
||||
unEscape (c:rest) = c : unEscape rest
|
||||
|
||||
|
||||
prop_readDoubleQuoted = isOk readDoubleQuoted "\"Hello $FOO\""
|
||||
readDoubleQuoted = called "double quoted string" $ do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue