Hands-on task
This task is step 3 of the course “Bash scripts: from a loop to a robust script”
Check whether a file exists
Write /usr/local/bin/checkfile: it takes a path as an argument, prints exists and exits with code 0 if the file is there, otherwise prints missing and exits with code 1.
Reference:Conditions and loops
What you'll practise:
- if branching
- test [ ]
- -f flag
- exit code
- positional arguments