From 1784972af7e195e35db37a761ba97a7c7a97ef04 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Tue, 23 Jul 2013 21:40:55 -0700 Subject: [PATCH] Don't warn about echo "--------" is posix mode --- ShellCheck/Analytics.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ShellCheck/Analytics.hs b/ShellCheck/Analytics.hs index 5d82676..a9ae1d2 100644 --- a/ShellCheck/Analytics.hs +++ b/ShellCheck/Analytics.hs @@ -398,8 +398,10 @@ checkBashisms = bashism when (isJust $ matchRegex regex str) $ warnMsg id feature bashism t@(T_SimpleCommand _ _ (cmd:arg:_)) - | t `isCommand` "echo" && "-" `isPrefixOf` (concat $ deadSimple arg) = - warnMsg (getId arg) "echo flag" + | t `isCommand` "echo" && "-" `isPrefixOf` argString = + when (not $ "--" `isPrefixOf` argString) $ -- echo "-------" + warnMsg (getId arg) "echo flag" + where argString = (concat $ deadSimple arg) bashism t@(T_SimpleCommand _ _ (cmd:arg:_)) | t `isCommand` "exec" && "-" `isPrefixOf` (concat $ deadSimple arg) = warnMsg (getId arg) "exec flag"