Hands-on task
This task is step 17 of the course “Bash scripts: from a loop to a robust script”
Validate input against a pattern
Write /usr/local/bin/isnum: if the passed argument consists only of digits — exit 0, otherwise exit 1. isnum 12345 → 0, isnum 12a45 → 1.
Reference:Conditions and loops
What you'll practise:
- case and glob patterns
- input validation
- exit code
- negation in [ ]
- positional arguments