Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to run ShellCheck on a script named script.sh.
Bash Scripting
shellcheck [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using options like -v or --help instead of the script file name.
Typing the wrong file name.
✗ Incorrect
To analyze a script with ShellCheck, you run
shellcheck followed by the script file name.2fill in blank
mediumComplete the command to show all ShellCheck warnings including info messages for myscript.sh.
Bash Scripting
shellcheck [1] myscript.sh Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
-e which excludes warnings.Using
-s which sets the shell dialect.✗ Incorrect
The
-a option tells ShellCheck to show all warnings including info messages.3fill in blank
hardFix the error in the ShellCheck command to analyze build.sh with the shell dialect set to bash.
Bash Scripting
shellcheck [1] build.sh Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a space instead of equals sign after
-s.Using incorrect option names like
--shell.✗ Incorrect
The correct syntax to set shell dialect is
-s=bash with an equals sign.4fill in blank
hardFill both blanks to ignore warning SC2086 and analyze deploy.sh with ShellCheck.
Bash Scripting
shellcheck [1] [2] deploy.sh
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up options or forgetting to specify the script file.
Using invalid option formats.
✗ Incorrect
Use
-e SC2086 to ignore that warning and -s=bash to set shell dialect.5fill in blank
hardFill all three blanks to run ShellCheck on test.sh, output results in JSON format, and enable shellcheck's external sourcing.
Bash Scripting
shellcheck [1] [2] [3] test.sh
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing output format option with ignore warning option.
Forgetting to specify shell dialect.
✗ Incorrect
Use
-x to enable external sourcing, -o json for JSON output, and -s=bash to set shell dialect.