title: How to get basename of parent's parent's directory name in shell?
body: <p>I want to get hold of the basename of the parent directory of the parent directory of the current directory in a shell script.</p>
  
  <p>For example:</p>
  
  <pre><code>$ pwd
  /home/tmp/terminal/env/1239754/control/state
  $
  </code></pre>
  
  <p>I want to get this - <code>1239754</code>.</p>