# cd into folder where the script is located, or quit (defensive)
# works even if the executable is a symlink, and on macOS and Linux.
# uses perl because this incantation was tested to be faster than alternatives.
BINPATH="$(perl -MCwd -le 'print Cwd::abs_path(shift)' "${BASH_SOURCE[0]}")"
cd "$(dirname "$BINPATH")" || exit 1
