> What is the correct way, or convention, to specify and parse command line arguments, for example?
I often use variations of this pattern:
version=1.0.0 usage() { cat << EOF USAGE: $0 {{-f|--file} <filename>} Some description. OPTIONS -h, --help Display this help. -v, --version Display version. -f <filepath>, --file <filepath> Specify input file. EOF } while (( $# )); do case "$1" in -h|--help) usage exit ;; -v|--version) printf "%s\n" "$version" exit ;; -f|--file) input_file="$2" shift ;; *) >&2 printf "Unknown option: %s\n" "$1" >&2 usage exit 1 ;; esac shift done
[1] https://www.gnu.org/prep/standards/standards.html#Command_00...
[2] https://cli-guide.readthedocs.io/en/latest/design/guidelines...
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1...
http://catb.org/~esr/writings/taoup/html/ch10s05.html
> What is the correct way, or convention, to specify and parse command line arguments, for example?
I often use variations of this pattern:
There are standard guidelines[1][2].[1] https://www.gnu.org/prep/standards/standards.html#Command_00...
[2] https://cli-guide.readthedocs.io/en/latest/design/guidelines...