Hands-on task
Quote the variable
The script /root/backup.sh copies the file passed as its first argument into /tmp/bk/, but shellcheck complains about an unquoted variable (because of which the script breaks on names with spaces). Fix it so that shellcheck produces no warnings and the script correctly copies even a file with a space in its name. Open the script in the Editor tab above the terminal, and run shellcheck in the terminal.
- shellcheck
- SC2086
- word splitting
- quoting
- cp