From 8be60028ef9ef52db907edb38f022802debe5b0b Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Thu, 22 Jul 2021 19:25:48 -0700 Subject: [PATCH] Don't warn when line starts with &> (fixes #2281) --- src/ShellCheck/Parser.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ShellCheck/Parser.hs b/src/ShellCheck/Parser.hs index 29dc4b0..4a01775 100644 --- a/src/ShellCheck/Parser.hs +++ b/src/ShellCheck/Parser.hs @@ -1996,12 +1996,14 @@ readHereString = called "here string" $ do word <- readNormalWord return $ T_HereString id word +prop_readNewlineList1 = isOk readScript "&> /dev/null echo foo" readNewlineList = many1 ((linefeed <|> carriageReturn) `thenSkip` spacing) <* checkBadBreak where checkBadBreak = optional $ do pos <- getPosition try $ lookAhead (oneOf "|&") -- See if the next thing could be |, || or && + notFollowedBy2 (string "&>") -- Except &> or &>> which is valid parseProblemAt pos ErrorC 1133 "Unexpected start of line. If breaking lines, |/||/&& should be at the end of the previous one." readLineBreak = optional readNewlineList