I would like to get the absolute path to an executed script. Its path is /use/local/lib/debugger.sh. And it is called through $PATH=/use/local/lib from another folder. I searched an example script and found following one.
echo "path = $(cd $(dirname $0) && pwd)"
I expected I can get the absolute path, /use/local/lib. But the result was not what I expected. I got the absolute path to the directory where the script is called.
How can I get the absolute path where the script exist?
Thank you very much.