I want its full pathname using 'dirname', but it will give me
unexpected result on some Linux or Bash versions.
Well, 'dirname' certainly won't do what you want, but I'm sorry,
I can't think of a way to get what you need. (It would be relatively
easy in 'c'.) Even /proc/self/* doesn't contain the script's full
pathname. Perhaps somebody else knows a better way.
Dave