Hands-on task
This task is step 22 of the course “Regular expressions”
Digits only
Write /usr/local/bin/isdigits: if the argument consists only of digits — exit 0, otherwise 1. Use a regex. The script is easiest to write in the Editor tab above the terminal: /usr/local/bin is open there next to /root.
What you'll practise:
- bash
- =~
- regular expressions
- anchors
- exit codes