Open kaushalmodi opened 9 years ago
It's funny that the moment I start searching for a way to get the name of the script being executed, I end up on the same source from where I learnt about readlink -f
: http://tipsarea.com/2013/04/11/how-to-get-the-script-path-name-in-cshtcsh/
Hi @kaushalmodi. Maybe you are looking for this:
SCRIPTPATH=$(cd $(dirname $0); pwd -P) && cd $SCRIPTPATH
@ninrod I do use $0
and dirname
but not in the same way. I need to handle the cases where the script is executed as source foo.csh
vs ./foo.csh
. Also, I wrap the script in a tcsh alias. I need to get the exact physical file name in that case, and that's why I need readlink
.
https://github.com/kaushalmodi/.emacs.d/issues/8#issuecomment-134997010