Hands-on task
Read a file with while read
The script /root/print.sh reads /root/items.txt with a for line in $(cat ...) construct and tears lines containing spaces apart. Rewrite the reading so that shellcheck is clean and the line hello world stays intact. Open the script in the Editor tab above the terminal, and run shellcheck in the terminal.
- shellcheck
- while read
- SC2013
- IFS
- line-by-line reading