Tags: #bash #git #repo #root
# /scripts/foo (this file) relies on /scripts/bar
#
# we want to be able to run this script from either:
#
# /scripts/foo or / (e.g. the root of the repo)
#
# e.g.
# ./scripts/foo
#
# or
#
# cd ./scripts && ./foo
#
# but the sourcing of another script within foo means we need
# an absolute path otherwise it won't find the sourced script
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "$REPO_ROOT/scripts/bar"