From c3cc5f649fb9124f5a95e3f7d1297d1901b2e466 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sat, 5 Apr 2014 12:49:24 -0700 Subject: [PATCH] Fixed warning about \n in echo -n -e '\n' --- ShellCheck/Analytics.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ShellCheck/Analytics.hs b/ShellCheck/Analytics.hs index 3610b4e..e608259 100644 --- a/ShellCheck/Analytics.hs +++ b/ShellCheck/Analytics.hs @@ -1577,11 +1577,14 @@ prop_checkUnusedEchoEscapes1 = verify checkUnusedEchoEscapes "echo 'foo\\nbar\\n prop_checkUnusedEchoEscapes2 = verifyNot checkUnusedEchoEscapes "echo -e 'foi\\nbar'" prop_checkUnusedEchoEscapes3 = verify checkUnusedEchoEscapes "echo \"n:\\t42\"" prop_checkUnusedEchoEscapes4 = verifyNot checkUnusedEchoEscapes "echo lol" +prop_checkUnusedEchoEscapes5 = verifyNot checkUnusedEchoEscapes "echo -n -e '\n'" checkUnusedEchoEscapes _ = checkCommand "echo" (const f) where isDashE = mkRegex "^-.*e" hasEscapes = mkRegex "\\\\[rnt]" - f (arg:_) | (concat $ deadSimple arg) `matches` isDashE = return () + f args | (concat $ concatMap deadSimple allButLast) `matches` isDashE = + return () + where allButLast = reverse . drop 1 . reverse $ args f args = mapM_ checkEscapes args checkEscapes (T_NormalWord _ args) =