On Thu, Jun 20, 2024 at 4:47 AM Léa Gris <lea.gris@noiraude.net> wrote:
> realSource=$(realpath -- "${BASH_SOURCE[0]}") &&
> realScriptDir=${realSource%/*}
`realScriptDir=$(realpath -m "${BASH_SOURCE}/..") || exit` is simpler
if you don't care about versions of realpath not supporting `-m`.
It is mostly convenient if you only need to load a single script. For example:
source "$(realpath -m "${BASH_SOURCE}/../../lib/script.bash")" || exit
--
konsolebox