Skip to content

Commit

Permalink
Recognize 'busybox' in --shell and directives. Add to doc texts.
Browse files Browse the repository at this point in the history
  • Loading branch information
koalaman committed Dec 11, 2023
1 parent fdcce45 commit 74282b0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion shellcheck.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ not warn at all, as `ksh` supports decimals in arithmetic contexts.

**-s**\ *shell*,\ **--shell=***shell*

: Specify Bourne shell dialect. Valid values are *sh*, *bash*, *dash* and *ksh*.
: Specify Bourne shell dialect. Valid values are *sh*, *bash*, *dash*, *ksh*,
and *busybox*.
The default is to deduce the shell from the file's `shell` directive,
shebang, or `.bash/.bats/.dash/.ksh` extension, in that order. *sh* refers to
POSIX `sh` (not the system's), and will warn of portability issues.
Expand Down
2 changes: 1 addition & 1 deletion shellcheck.hs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ options = [
"Specify path when looking for sourced files (\"SCRIPTDIR\" for script's dir)",
Option "s" ["shell"]
(ReqArg (Flag "shell") "SHELLNAME")
"Specify dialect (sh, bash, dash, ksh)",
"Specify dialect (sh, bash, dash, ksh, busybox)",
Option "S" ["severity"]
(ReqArg (Flag "severity") "SEVERITY")
"Minimum severity of errors to consider (error, warning, info, style)",
Expand Down
2 changes: 2 additions & 0 deletions src/ShellCheck/Checks/ShellSupport.hs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ prop_checkBashisms116 = verify checkBashisms "#!/bin/busybox sh\nx='test'\n${x[1
prop_checkBashisms117 = verify checkBashisms "#!/bin/busybox sh\nx='test'\n${!x[@]}" -- SC3055
prop_checkBashisms118 = verify checkBashisms "#!/bin/busybox sh\nxyz=1\n${!x*}" -- SC3056
prop_checkBashisms119 = verify checkBashisms "#!/bin/busybox sh\nx='test'\n${x^^[t]}" -- SC3059
prop_checkBashisms120 = verify checkBashisms "#!/bin/sh\n[ x == y ]"
prop_checkBashisms121 = verifyNot checkBashisms "#!/bin/sh\n# shellcheck shell=busybox\n[ x == y ]"
checkBashisms = ForShell [Sh, Dash, BusyboxSh] $ \t -> do
params <- ask
kludge params t
Expand Down
1 change: 1 addition & 0 deletions src/ShellCheck/Data.hs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ shellForExecutable name =
"sh" -> return Sh
"bash" -> return Bash
"bats" -> return Bash
"busybox" -> return BusyboxSh -- Used for directives and --shell=busybox
"busybox sh" -> return BusyboxSh
"busybox ash" -> return BusyboxSh
"dash" -> return Dash
Expand Down

0 comments on commit 74282b0

Please sign in to comment.