diff --git a/ShellCheck/ASTLib.hs b/ShellCheck/ASTLib.hs index 6e60618..23bbb98 100644 --- a/ShellCheck/ASTLib.hs +++ b/ShellCheck/ASTLib.hs @@ -112,8 +112,8 @@ getFlagsUntil _ _ = error "Internal shellcheck error, please report! (getFlags o -- Get all flags in a GNU way, up until -- getAllFlags = getFlagsUntil (== "--") --- Get all flags in a BSD way, up until first non-flag argument -getLeadingFlags = getFlagsUntil (not . ("-" `isPrefixOf`)) +-- Get all flags in a BSD way, up until first non-flag argument or -- +getLeadingFlags = getFlagsUntil (\x -> x == "--" || (not $ "-" `isPrefixOf` x)) -- Given a T_DollarBraced, return a simplified version of the string contents. diff --git a/ShellCheck/Checks/ShellSupport.hs b/ShellCheck/Checks/ShellSupport.hs index 7e1440b..6c66e50 100644 --- a/ShellCheck/Checks/ShellSupport.hs +++ b/ShellCheck/Checks/ShellSupport.hs @@ -133,6 +133,7 @@ prop_checkBashisms49= verify checkBashisms "#!/bin/dash\necho $MACHTYPE" prop_checkBashisms50= verify checkBashisms "#!/bin/sh\ncmd >& file" prop_checkBashisms51= verifyNot checkBashisms "#!/bin/sh\ncmd 2>&1" prop_checkBashisms52= verifyNot checkBashisms "#!/bin/sh\ncmd >&2" +prop_checkBashisms53= verifyNot checkBashisms "#!/bin/sh\nprintf -- -f\n" checkBashisms = ForShell [Sh, Dash] $ \t -> do params <- ask kludge params t