mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 11:19:45 +08:00
Updated SC2249 (markdown)
@@ -35,7 +35,7 @@ Consider adding a default case to handle other values. If you don't know what to
|
||||
|
||||
The example is adapted from a real world Debian init script, which due to a missing default case reports success on any misspelled command (here with underscore instead of dash):
|
||||
|
||||
```
|
||||
```console
|
||||
$ /etc/init.d/screen-cleanup force_reload && echo success
|
||||
success
|
||||
```
|
||||
@@ -46,7 +46,7 @@ This suggestion only triggers in verbose mode (`-S verbose`).
|
||||
|
||||
If you don't have a default case because the default should be to take no action, consider adding a comment to other humans:
|
||||
|
||||
```
|
||||
```sh
|
||||
case "$(uname)" in
|
||||
CYGWIN*) cygwin=1;;
|
||||
MINGW*) mingw=1;;
|
||||
@@ -56,7 +56,7 @@ esac
|
||||
|
||||
If you believe that it's impossible for the expression to have any other value, it's considered good practice to add the equivalent of an `assert(0)` to fail fast if this assumption should turn out to be incorrect in the current or future versions:
|
||||
|
||||
```
|
||||
```sh
|
||||
case "$result" in
|
||||
true) proceed;;
|
||||
false) cancel;;
|
||||
|
Reference in New Issue
Block a user