This is not as trivial as it looks like. Check out this question and this
0
votes
alternative method
pid=$$
path=$(ps -eo pid,args| awk -vp=$pid '$1~p{print $3}')
case "$path" in
./* ) pwd;;
* ) echo $path;;
esac
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more