Skip to content

Instantly share code, notes, and snippets.

@fabito
Forked from jhrr/boilerplate.sh
Created May 30, 2018 18:49
Show Gist options
  • Save fabito/fdbd71e6ce5cb4141d5790ede666de13 to your computer and use it in GitHub Desktop.
Save fabito/fdbd71e6ce5cb4141d5790ede666de13 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Bash3 Boilerplate. Copyright (c) 2014, kvz.io
set -o errexit
set -o pipefail
set -o nounset
# set -o xtrace
# Set magic variables for current file & dir
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__root="$(cd "$(dirname "${__dir}")" && pwd)" # <-- change this
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
__base="$(basename ${__file} .sh)"
arg1="${1:-}"
# It often simplifies input/output logic to let the script operate
# in a fresh working directory by using:
pushd $(mktemp -d)
# and then fill that directory with various output files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment