title: Remove current directory from variable containing path
body: <p>I have a variable which contains the current directory including several parents. For example:</p>
  
  <pre><code>$ pwd
  /Users/simont/repositories
  $ echo $current
  ~/repositories
  </code></pre>
  
  <p>I can strip everything <em>except</em> the current directory from <a href="https://stackoverflow.com/questions/1371261/get-current-directory-name-without-full-path-in-bash-script">this question</a>:</p>
  
  <pre><code>onlycurrent=${$(current)##*/}
  </code></pre>
  
  <p>I want to do the opposite: remove the current dir from this variable (so that it only contains <code>~/</code>). How can I do this?</p>