Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

How to get top level parent directory

$
0
0
Hi All,
I have a directory like this: /u01/app/oracle/11gSE1/11gR203

How do i get the top level directory /u01 from this? Tried dirname and basename but dint help. I can this using echo $ORACLE_HOME | awk -F"/" '{print "/"$2}'. But I am trying to find out if there is a better way of doing it other than using awk. Thanks in advance.

Viewing all articles
Browse latest Browse all 16232

Trending Articles