Created
July 8, 2020 21:00
-
-
Save bsnux/73c9112878e5153cb8421f1bac4658c7 to your computer and use it in GitHub Desktop.
Simple template for shell scripts
This file contains hidden or 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
#!/bin/bash | |
# help-template.sh | |
# | |
# Simple template for shell scripts | |
# | |
Help=$(cat <<-"HELP" | |
my-script — does one thing well | |
Usage: | |
my-script <input> <output> | |
Options: | |
<input> Input file to read. | |
<output> Output file to write. Use '-' for stdout. | |
-h Show this message. | |
HELP | |
) | |
help() { | |
echo "$Help" | |
} | |
if [[ $# == 0 ]] || [[ "$1" == "-h" ]]; then | |
help | |
exit 1 | |
fi | |
echo "Hello World" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment