Skip to content

Commit

Permalink
Fix SC3045 for busybox shell
Browse files Browse the repository at this point in the history
  • Loading branch information
sertonix committed Jul 2, 2024
1 parent 2ee1d65 commit bfd4097
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/ShellCheck/Checks/ShellSupport.hs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ prop_checkBashisms120 = verify checkBashisms "#!/bin/sh\n[ x == y ]"
prop_checkBashisms121 = verifyNot checkBashisms "#!/bin/sh\n# shellcheck shell=busybox\n[ x == y ]"
prop_checkBashisms122 = verify checkBashisms "#!/bin/dash\n$'a'"
prop_checkBashisms122 = verifyNot checkBashisms "#!/bin/busybox sh\n$'a'"
prop_checkBashisms123 = verify checkBashisms "#!/bin/dash\ntype -p test"
prop_checkBashisms124 = verifyNot checkBashisms "#!/bin/busybox sh\ntype -p test"
prop_checkBashisms36 = verifyNot checkBashisms "#!/bin/busybox sh\nread -p foo -r bar"
checkBashisms = ForShell [Sh, Dash, BusyboxSh] $ \t -> do
params <- ask
kludge params t
Expand Down Expand Up @@ -446,10 +449,10 @@ checkBashisms = ForShell [Sh, Dash, BusyboxSh] $ \t -> do
("hash", Just $ if isDash then ["r", "v"] else ["r"]),
("jobs", Just ["l", "p"]),
("printf", Just []),
("read", Just $ if isDash then ["r", "p"] else ["r"]),
("read", Just $ if isDash || isBusyboxSh then ["r", "p"] else ["r"]),
("readonly", Just ["p"]),
("trap", Just []),
("type", Just []),
("type", Just $ if isBusyboxSh then ["p"] else []),
("ulimit", if isDash then Nothing else Just ["f"]),
("umask", Just ["S"]),
("unset", Just ["f", "v"]),
Expand Down

0 comments on commit bfd4097

Please sign in to comment.