Hands-on task
A size-counting script: zero warnings
The script /root/dirsize.sh appends a line <directory>: <N> bytes to /var/reports/summary.log for the directory given as the first argument. It breaks on a directory with a space in its name (/srv/my data), and shellcheck finds several issues in it. Fix them all so that shellcheck is silent and the script works on such paths too. Open the script in the Editor tab above the terminal.
- shellcheck
- quoting
- $( )
- cd || exit
- spaces in paths