I have a bash script that will be sourced rather than run. Is there
anyway for the script to determine its location (pathname)?
Specifically, in my .bashrc I have:
if [ -f /devel/bashrc ]; then
. /devel/bashrc
fi
Is there any way for /devel/bashrc to determine what directory it is
in? The reason is that /devel/bashrc is a delivered file and it might
wind up in any directory (and probably not /devel) and it needs to
know where itself is so it can set environment variables correctly.
Obviously $0 doesn't help, because that contains "bash".