Hands-on task
Make cd safe
The script /root/clean.sh changes into a directory and deletes temporary files there. shellcheck warns that cd without a check is dangerous: if the change fails, the script will keep running in the wrong place. Fix it so the linter stays silent while the behavior remains the same. Open the script in the Editor tab above the terminal, and run shellcheck in the terminal.
- shellcheck
- SC2164
- cd
- error handling
- ||