Hands-on task
A strict script without warnings
Write /root/words.sh in strict mode set -euo pipefail that shellcheck won't find fault with. Without an argument the script prints a line starting with usage: to stderr and exits with code 64. With a file path it prints only the number of words in the file; the path may contain spaces. It's handy to write the script in the Editor tab above the terminal, and run shellcheck in the terminal.
- set -euo pipefail
- $#
- exit codes
- stderr
- shellcheck