title: Getting parent's directory name by piping the results of dirname to basename in a Bash script
body: <p>Given a path like this <strong>test/90_2a5/Windows</strong></p>
  
  <p>I am trying to get the result <strong>90_2a5</strong> using the commands <code>dirname</code> to get the path and after <code>basename</code> to get the name.</p>
  
  <p>The problem occurs when i try to make it in a single line trying to pipe the results from <code>dirname</code> to <code>basename</code>.</p>
  
  <p>I have tried this but seems that i am using it the wrong way.</p>
  
  <pre><code>path="test/90_2a5/Windows"   
  finalName= basename var | dirname $path  
  echo "$finalName"
  </code></pre>
  
  <p>The problem is that the <em>finalName</em> is an empty string, meaning that the results from <code>dirname</code> are not redirecting.</p>