Created
July 26, 2013 12:08
-
-
Save jdu/6088390 to your computer and use it in GitHub Desktop.
A starter template for writing your own tools shell script.
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
#!/usr/bin/env bash | |
now=`date +"%m_&d_%Y"` | |
VER="0.0.1" | |
AUTHOR="Your Name" | |
function an_action() { | |
echo "Hello World!" | |
} | |
function output_help() { | |
echo | |
echo "# My Script Tools" | |
echo | |
echo " --output_help Outputs this help info" | |
echo " --version Outputs the current script version" | |
} | |
function output_version() { | |
echo "My Tools v${VER}" | |
echo "Author(s): ${AUTHOR}" | |
} | |
if [ "$1" ]; then | |
case $1 in | |
"--version") | |
output_version | |
exit 0 | |
;; | |
"--help") | |
output_help | |
exit 0 | |
;; | |
*) | |
echo "Unrecognized option ${1}. please try again." | |
exit 1 | |
;; | |
esac | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment