0
0
Bash Scriptingscripting~10 mins

ShellCheck for static analysis in Bash Scripting - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Ascript.sh
B-v
C--help
Dcheck.sh
Attempts:
3 left
💡 Hint
Common Mistakes
Using options like -v or --help instead of the script file name.
Typing the wrong file name.
2fill in blank
medium

Complete 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'
A-s
B-e
C-a
D-x
Attempts:
3 left
💡 Hint
Common Mistakes
Using -e which excludes warnings.
Using -s which sets the shell dialect.
3fill in blank
hard

Fix 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'
A-s bash
B-s=bash
C--shell bash
D-shell bash
Attempts:
3 left
💡 Hint
Common Mistakes
Using a space instead of equals sign after -s.
Using incorrect option names like --shell.
4fill in blank
hard

Fill 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'
A-e SC2086
B-s=bash
C-x
D-a
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up options or forgetting to specify the script file.
Using invalid option formats.
5fill in blank
hard

Fill 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'
A-x
B-o json
C-s=bash
D-e SC1090
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing output format option with ignore warning option.
Forgetting to specify shell dialect.