Hands-on task
This task is step 7 of the course “Clean scripts: shellcheck”
Compare numbers as numbers
The script /root/cmp.sh compares the numbers 9 and 10 with a string operator and wrongly decides that 9 is greater than 10. Fix the comparison to be numeric, so the script prints smaller and shellcheck is clean.
Reference:shellcheck
What you'll practise:
- shellcheck
- numeric comparison
- SC2071
- (( ))
- -gt