The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 09-26-2007
tomas's Avatar
tomas tomas is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 35
This is an ugly way to do it.

VAR0=`echo $HOME | cut -f3 -d'/'`
VAR1=`echo $HOME | wc -c`
VAR2=`pwd | cut -c${VAR1}-`
echo ${VAR0}${VAR2}

But it will give you the desired output.

I wouldn't use this example because if you go below your $HOME path it doesn't show anything.