title: Get current directory, not path, in a function .bashrc
body: <p>I would like to display a * in my prompt if the name of the current rvm gemset does not match the name of the current directory. I can get the name of the current gemset with no problem by using <code>$(~/.rvm/bin/rvm-prompt g)</code> which, if the gemset is foo, will return <code>@foo</code>.</p>
  
  <p>I've tried both <code>"@${PWD##*/}"</code> and <code>"@${\W}"</code> but unfortunately with no success. My entire function looks like this:</p>
  
  <pre><code>function ps1_rvm() {
    [[ $(~/.rvm/bin/rvm-prompt g) != "@${PWD##*/}" ]] &amp;&amp; echo "*"
  }
  </code></pre>
  
  <p>I am then using this function to set the value of PS1 so that it is output to my prompt.</p>
  
  <p>Edit: I want to get the directory name, not the path.</p>