Skip to content

Instantly share code, notes, and snippets.

@jdu
Created July 26, 2013 12:08
Show Gist options
  • Save jdu/6088390 to your computer and use it in GitHub Desktop.
Save jdu/6088390 to your computer and use it in GitHub Desktop.
A starter template for writing your own tools shell script.
#!/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