Parse FD move operations like 2>&1- correctly. Fixes #1180.
This commit is contained in:
parent
aa3b3fdc56
commit
cf608dc2f6
|
@ -16,6 +16,7 @@
|
|||
- Associative arrays are now respected in arithmetic contexts
|
||||
- SC1087 about `$var[@]` now correctly triggers on any index
|
||||
- Bad expansions in here documents are no longer ignored
|
||||
- FD move operations like {fd}>1- now parse correctly
|
||||
|
||||
### Changed
|
||||
- SC1073: 'else if' is now parsed correctly and not like 'elif'
|
||||
|
|
|
@ -1401,6 +1401,7 @@ prop_checkSpuriousExec4 = verifyNot checkSpuriousExec "if a; then exec b; fi"
|
|||
prop_checkSpuriousExec5 = verifyNot checkSpuriousExec "exec > file; cmd"
|
||||
prop_checkSpuriousExec6 = verify checkSpuriousExec "exec foo > file; cmd"
|
||||
prop_checkSpuriousExec7 = verifyNot checkSpuriousExec "exec file; echo failed; exit 3"
|
||||
prop_checkSpuriousExec8 = verifyNot checkSpuriousExec "exec {origout}>&1- >tmp.log 2>&1; bar"
|
||||
checkSpuriousExec _ = doLists
|
||||
where
|
||||
doLists (T_Script _ _ cmds) = doList cmds
|
||||
|
|
|
@ -1716,8 +1716,15 @@ readIoFileOp = choice [g_DGREAT, g_LESSGREAT, g_GREATAND, g_LESSAND, g_CLOBBER,
|
|||
readIoDuplicate = try $ do
|
||||
id <- getNextId
|
||||
op <- g_GREATAND <|> g_LESSAND
|
||||
target <- readIoVariable <|> many1 digit <|> string "-"
|
||||
target <- readIoVariable <|> digitsAndOrDash
|
||||
return $ T_IoDuplicate id op target
|
||||
where
|
||||
-- either digits with optional dash, or a required dash
|
||||
digitsAndOrDash = do
|
||||
str <- many digit
|
||||
dash <- (if null str then id else option "") $ string "-"
|
||||
return $ str ++ dash
|
||||
|
||||
|
||||
prop_readIoFile = isOk readIoFile ">> \"$(date +%YYmmDD)\""
|
||||
readIoFile = called "redirection" $ do
|
||||
|
@ -1744,6 +1751,7 @@ prop_readIoRedirect3 = isOk readIoRedirect "4>&-"
|
|||
prop_readIoRedirect4 = isOk readIoRedirect "&> lol"
|
||||
prop_readIoRedirect5 = isOk readIoRedirect "{foo}>&2"
|
||||
prop_readIoRedirect6 = isOk readIoRedirect "{foo}<&-"
|
||||
prop_readIoRedirect7 = isOk readIoRedirect "{foo}>&1-"
|
||||
readIoRedirect = do
|
||||
id <- getNextId
|
||||
n <- readIoSource
|
||||
|
|
Loading…
Reference in New Issue