diff --git a/Optional.md b/Optional.md index 70f869c..68aee3f 100644 --- a/Optional.md +++ b/Optional.md @@ -1,4 +1,4 @@ -## Optional Checks +## Optional checks ShellCheck supports additional checks that are not enabled by default. These are generally subjective or stylistic. @@ -6,7 +6,7 @@ ShellCheck supports additional checks that are not enabled by default. These are Checks can be enabled with flags or an `enable` [[directive]] in the file or `.shellcheckrc`: -``` +```sh #!/bin/sh # shellcheck enable=require-variable-braces echo "$RANDOM" # Will emit a suggestion to use `${RANDOM}` @@ -14,7 +14,11 @@ echo "$RANDOM" # Will emit a suggestion to use `${RANDOM}` or put `enable=require-variable-braces` in a `.shellcheckrc` in your home directory or project root. -They can also be enabled on the command line with `shellcheck -o require-variable-braces myscript` +They can also be enabled on the command-line with `-o`: + +```console +$ shellcheck -o require-variable-braces myscript +``` ### Enabling all checks @@ -29,7 +33,8 @@ However, if you for debugging or evaluation purposes want to see what's availabl To see which checks are available in your version of ShellCheck, use the `--list-optional` flag. Optional checks as of version 0.8.0: -``` + +```console $ shellcheck --list-optional name: add-default-case @@ -76,4 +81,4 @@ name: require-variable-braces desc: Suggest putting braces around all variable references example: var=hello; echo $var fix: var=hello; echo ${var} -``` \ No newline at end of file +```