From 112a7d8b9b819c38884527ada71539f3a9b745d7 Mon Sep 17 00:00:00 2001 From: Gandalf- Date: Fri, 11 Jan 2019 10:17:44 -0800 Subject: [PATCH] Issue 1330 unsupported echo flags Issue https://github.com/koalaman/shellcheck/issues/1330 Addresses false positives when quoted arguments to echo begin with what looks like a flag. Now, warn only when the first argument is a recognized echo flag when flags are unsupported. --- src/ShellCheck/Checks/ShellSupport.hs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/ShellCheck/Checks/ShellSupport.hs b/src/ShellCheck/Checks/ShellSupport.hs index 8f55b3c..40397af 100644 --- a/src/ShellCheck/Checks/ShellSupport.hs +++ b/src/ShellCheck/Checks/ShellSupport.hs @@ -152,6 +152,10 @@ prop_checkBashisms69 = verifyNot checkBashisms "#!/bin/sh\numask -S" prop_checkBashisms70 = verify checkBashisms "#!/bin/sh\ntrap -l" prop_checkBashisms71 = verify checkBashisms "#!/bin/sh\ntype -a ls" prop_checkBashisms72 = verifyNot checkBashisms "#!/bin/sh\ntype ls" +prop_checkBashisms73 = verifyNot checkBashisms "#!/bin/sh\necho \"-n foo\"" +prop_checkBashisms74 = verifyNot checkBashisms "#!/bin/sh\necho \"-ne foo\"" +prop_checkBashisms75 = verifyNot checkBashisms "#!/bin/sh\necho -Q foo" +prop_checkBashisms76 = verify checkBashisms "#!/bin/sh\necho -ne foo" checkBashisms = ForShell [Sh, Dash] $ \t -> do params <- ask kludge params t @@ -238,15 +242,17 @@ checkBashisms = ForShell [Sh, Dash] $ \t -> do warnMsg id "`