Parse optional verbose/version flags with shorthands

getopt

  • Parse command line arguments.
    More information: <https://www.gnu.org/software/libc/manual/html_node/Getopt.html>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

getopt --options vV --longoptions verbose,version -- --version --verbose

click the source code to copy install getopt on any operating system with command-not-found.com