Hands-on task
A script with flags via getopts
Write an executable /usr/local/bin/greet that accepts the flag -n <name> and prints Hello, <name>!. Without the -n flag — exit with code 1. The script is easiest to write in the Editor tab above the terminal: /usr/local/bin is open there next to /root.
- getopts
- bash scripts
- flag parsing
- $OPTARG
- return codes