Don't warn when line starts with &> (fixes #2281)

This commit is contained in:
Vidar Holen 2021-07-22 19:25:48 -07:00
parent 9b077e28cb
commit 8be60028ef
1 changed files with 2 additions and 0 deletions

View File

@ -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