diff --git a/CHANGELOG.md b/CHANGELOG.md index 9224fce..e2b5098 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Released: TBA. [Diff](https://github.com/kvz/bash3boilerplate/compare/v2.4.2...master). - [x] Add feature to edit/update comments in ini file (#132, @rfuehrer) +- [x] New magic variable `__origin` when called via symlink (@efelon) ## v2.4.2 diff --git a/README.md b/README.md index 246dde9..be85192 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,7 @@ We are looking for endorsements! Are you also using b3bp? [Let us know](https:// - [Lukas Stockner](mailto:oss@genesiscloud.com) - [Gert Goet](https://github.com/eval) - [@rfuehrer](https://github.com/rfuehrer) +- [@efelon](https://github.com/efelon) ## License diff --git a/main.sh b/main.sh index a29794e..f926bda 100755 --- a/main.sh +++ b/main.sh @@ -47,6 +47,7 @@ fi __dir="$(cd "$(dirname "${BASH_SOURCE[${__b3bp_tmp_source_idx:-0}]}")" && pwd)" __file="${__dir}/$(basename "${BASH_SOURCE[${__b3bp_tmp_source_idx:-0}]}")" __base="$(basename "${__file}" .sh)" +__origin="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[${__b3bp_tmp_source_idx:-0}]}")")" && pwd)" # shellcheck disable=SC2034,SC2015 __invocation="$(printf %q "${__file}")$( (($#)) && printf ' %q' "$@" || true)" @@ -412,6 +413,7 @@ info "__i_am_main_script: ${__i_am_main_script}" info "__file: ${__file}" info "__dir: ${__dir}" info "__base: ${__base}" +info "__origin: ${__origin}" info "OSTYPE: ${OSTYPE}" info "arg_f: ${arg_f}"