I'd like to retrieve the absolute file name of the script file that's currently executed. Links should be resolved, too.
On Linux, this seems to be done like this:
$(readlink -mn "$0")
but readlink
seems to work very differently on Mac OS X.
I've read that this is done using
$(realpath $0)
in BSD but that doesn't work, either. Mac OS X does not have realpath
.
Any idea?