How may I detect the name of the directory (or better yet the entire path) in which my shell script is run?
alternative method
pid=$$ path=$(ps -eo pid,args| awk -vp=$pid '$1~p{print $3}') case "$path" in ./* ) pwd;; * ) echo $path;; esac