Possibly this question seems stupid but anyway. I have a script file /local/bin/app1/script.sh and I need to know its parents parent directory name bin. I know that I can use ${0%/*} to determine the parent directory name. I’m not familiar with bash so could somebody please help me to figure out parents parent directory name? Many thanks.
Possibly this question seems stupid but anyway. I have a script file /local/bin/app1/script.sh and
Share
Just apply the trick once more:
Or, let the shell tell you