Skip to content

Instantly share code, notes, and snippets.

@mattdanielbrown
Created December 13, 2022 05:36
Show Gist options
  • Select an option

  • Save mattdanielbrown/af091a529b61980c9701f4d005698e5b to your computer and use it in GitHub Desktop.

Select an option

Save mattdanielbrown/af091a529b61980c9701f4d005698e5b to your computer and use it in GitHub Desktop.
Bash Script USAGE (function, message, text content) TEMPLATE ( and/or example ... )
# Print usage
usage() {
echo -n "${scriptName} [OPTION]... [FILE]...
NAME
==============================================================================
The Full Name
• Expanded or 'Friendly' : Name Of The Script/App/Project
• SOURCE FILE : 'true_executable_filename' | 'source_script_filename.sh'
• EXEC|CMD|ALIAS Name(s) : 'exec_name' , 'cmdAlias' , 'cliToolName'
DESCRIPTION
==============================================================================
This is my script template.
OPTIONS
==============================================================================
-f, --foo Foo param, arg or flag opt
-b, --bar Bar param, arg or flag opt
-a, --automate Skip all user interaction, assuming default vaules
-q, --quiet Quiet (no output)
-l, --log Print log to file
-s, --strict Exit script with null variables. i.e 'set -o nounset'
-V, --verbose Output more information. (Items echoed to 'verbose')
-d, --debug Runs script in BASH debug mode (set -x)
-h, --help Display this help and exit
-v --version Output version information and exit
"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment