Files
test-projects/bash-test.sh
T

16 lines
352 B
Bash
Executable File

#!/usr/bin/env bash
# NOTE: this is way simpler
echo $(realpath "${BASH_SOURCE}")
# NOTE: this is useless
if [[ "${0}" == "${BASH_SOURCE}" ]]; then
root_dir="$(dirname "${0}")"
root_dir="$(realpath "${root_dir}")"
else
root_dir="$(dirname "${0}")/$(dirname "${BASH_SOURCE}")"
root_dir="$(realpath "${root_dir}")"
fi
echo ${root_dir}