Last active
July 14, 2019 21:06
-
-
Save rot26/d8565404c933cef0e8874f0ccf775557 to your computer and use it in GitHub Desktop.
[default bash script] #default #fav #bash #shell
This file contains 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 | |
# SheBang defaults to environment's bash | |
# Set errexit / Do not continue on errors | |
set -e; | |
# Set bash debug | |
if [[ "$@" == *"--debug"* ]] || [ ${BASH_DEBUG} ]; then | |
export BASH_DEBUG=true; | |
set -x; | |
fi | |
# Reference Path of this script | |
SCRIPT_PATH="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)" | |
# Reference path where you will run script paths from | |
SCRIPT_ROOT="$(cd "${SCRIPT_PATH}/.." && pwd)" | |
# All paths are referenced from $SCRIPT_ROOT unless otherwise specified | |
cd "${SCRIPT_ROOT}" | |
# Replace script here | |
echo "SCRIPT_PATH= ${SCRIPT_PATH}" | |
echo "SCRIPT_ROOT= ${SCRIPT_ROOT}" | |
echo "CWD = $(pwd)" | |
echo "BASH_DEBUG = ${BASH_DEBUG}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment