Last active
December 11, 2023 22:02
-
-
Save mattdanielbrown/f00f119358b57a20ca9db67718dfbaf3 to your computer and use it in GitHub Desktop.
Bash Script USAGE (function, message, text content) TEMPLATE ( and/or example ... ) [ >> VERSION 2.1 ]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#=============================================================================== | |
# NAME : bash_script_usage_v2.template.sh | |
# VERSION : 2.1.0 | |
# CREATED : Dec 12 23:41:26 CST 2022 | |
# AUTHOR : Matt Daniel Brown <[email protected]> | |
# WEB : gist.github.com/mattdanielbrown/f00f119358b57a20ca9db67718dfbaf3 | |
#------------------------------------------------------------------------------- | |
# USAGE : Copy the `usage()` function below and paste into your bash script | |
# ... and then, replace the details as is appropriate for your script. | |
#=============================================================================== | |
# Print usage | |
usage() { | |
echo -n "${scriptName} [OPTION]... [FILE]... | |
NAME | |
================================================================================ | |
The Full Name | |
• Expanded ('Friendly') Name Of The Script/App/Project | |
• SOURCE FILE ('true_executable_filename' | 'source_script_filename.sh') | |
• EXEC|CMD|ALIAS Name(s) (`execName` , `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