I want to obtain the path of a Bash script, is when it’s executed through a symlink.
In this case,
BASH_SOURCE is the symlink’s path.
Can I obtain the script’s path through some shell variable, built-in shell command, or external command?
BASH_SOURCE always holds the initial symlink’s path, even if the script is executed through several levels of indirection (multiple symlinks)?
Could I use
BASH_SOURCE to always retrieve the script’s path?
Go to Source