Run
Run the script by the name you chose, once the bin directory is on PATH.
Help and verbose
--help prints the options and exits 0. A value option line shows the long name, the short name when you set one, the type, required when it is required, the default when there is one, and the choices for a one-of check. An integer line says signed or unsigned. A switch line prints the names and the help, and it omits a type.
--verbose raises the log level. .log writes a log line. The first argument is the level.
Names
Hyphens in the long name become underscores, and the name is uppercased. dry-run becomes DRY_RUN.
A value option sets NAME_ARG and NAME_OPTION_CHOSEN. NAME_ARG is the value after the checks pass. NAME_OPTION_CHOSEN is 1 when the option was present and 0 when it was not. If you leave the option off and it is not required, NAME_ARG is the default and NAME_OPTION_CHOSEN is 0.
A switch sets NAME_OPTION_CHOSEN only. It has no NAME_ARG.
Exits
Your code starts only after the checks pass. Exit 1 and exit 3 stop inside do-not-modify/. -- ends the options. A positional argument after it still exits 3.
| Exit | Meaning |
|---|---|
| 0 | The checks passed. Your code runs. |
| 1 | A value was missing or invalid. |
| 3 | An unknown flag, or a positional argument. |
A notify script
A notify script with a required email option sets these names before your code runs:
EMAIL_OPTION_CHOSEN=0
EMAIL_ARG=''Its help includes this line:
-e, --email who (required, string)