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 because I don't know how to count the occurance of '/' from `pwd`. I posted this question on the UNIX script forum, and Tanda suggests me to ask help from this forum. I appreciate it if anybody can help me with this problem.
Thanks in advance.
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 because I don't know how to count the occurance of '/' from `pwd`. I posted this question on the UNIX script forum, and Tanda suggests me to ask help from this forum. I appreciate it if anybody can help me with this problem.
Thanks in advance.