Skip to content

Instantly share code, notes, and snippets.

@e-kostylov
Created September 27, 2016 09:48
Show Gist options
  • Save e-kostylov/db37880c4526b6d557e9088b73deec0f to your computer and use it in GitHub Desktop.
Save e-kostylov/db37880c4526b6d557e9088b73deec0f to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
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)"
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
__base="$(basename ${__file} .sh)"
__root="$(cd "$(dirname "${__dir}")" && pwd)" # <-- change this as it depends on your app
arg1="${1:-}"
echo ${__dir}
echo ${__file}
echo ${__base}
echo ${__root}
echo ${arg1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment