Skip to content

Instantly share code, notes, and snippets.

@trailjeep
Forked from bertvv/bash_template.sh
Created February 1, 2019 19:20
Show Gist options
  • Save trailjeep/8bc4711474c2ad3c5a7f62befb5df3d3 to your computer and use it in GitHub Desktop.
Save trailjeep/8bc4711474c2ad3c5a7f62befb5df3d3 to your computer and use it in GitHub Desktop.
Simple Bash script template
#!/usr/bin/env bash
#
# Script name -- purpose
#
# Author:
set -o errexit # abort on nonzero exitstatus
set -o nounset # abort on unbound variable
#
# Functions
#
usage() {
cat << _EOF_
Usage: ${0}
_EOF_
}
#
# Variables
#
#
# Command line parsing
#
if [ "$#" -ne "1" ]; then
echo "Expected 1 argument, got $#" >&2
usage
exit 2
fi
#
# Script proper
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment