Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there any way to get the last several subdirectories of `pwd`?

Status
Not open for further replies.

lmm8294

Technical User
Aug 20, 2001
8
US
I need to modify the .profile of an account, and I have this line in the .profile:
PS1=`hostname`':$LOGNAME:$PWD>'

But my boss want me to get only the last 3 levels of the subdirectory if `pwd` returns a long path. For example, if `pwd` returns /appl/oracle/instance001/d01/oracle/001appl/admin,

then he want only oracle/001appl/admin displayed. Could anybody help me? I have tried to use 'cut -d/ -f ...', but it does not work for me.


Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top