I want to get hold of the basename of the parent directory of the parent directory of the current directory in a shell script.
For example:
$ pwd
/home/tmp/terminal/env/1239754/control/state
$
I want to get this - 1239754
.
you can try this
basename `cd ../..; pwd`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With