Say I put an executable tcsh file in /path/to/my_script.csh
and my current directory is anywhere, for example I\'m in /path
So I type to/my_script.csh
I
If you want to ensure the same result (full path and script name) try something like this:
...
rootdir=`/bin/dirname $0` # may be relative path
rootdir=`cd $rootdir && pwd` # ensure absolute path
zero=$rootdir/`/bin/basename $0`
echo $zero
...
Then you can call it as foo.sh, ./foo.sh, some/lower/dir/foo.sh and still get the same result no matter how it is called.