diff --git a/bash-test.sh b/bash-test.sh index 150eca7..b7ae015 100755 --- a/bash-test.sh +++ b/bash-test.sh @@ -1,10 +1,15 @@ #!/usr/bin/env bash -if ! $(which navig &>/dev/null); then - echo "command not found" - return 1 +# 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 -function bash_source_test_function { - echo "sourcing not interrupted" -} +echo ${root_dir}