title: Retrieve parent directory of script
body: <p>I'm working on an uninstaller script to delete the parent folder where the script is installed.</p>
  
  <pre><code>/usr/local/Myapplication/Uninstaller/uninstall.sh
  </code></pre>
  
  <p>So uninstall.sh has to do this:</p>
  
  <pre><code>rm- rf /usr/local/Myapplication
  </code></pre>
  
  <p>I can retrieve the folder where uninstall resides</p>
  
  <pre><code>SYMLINKS=$(readlink -f "$0")
  UNINSTALL_PATH=$(dirname "$SYMLINKS")
  </code></pre>
  
  <p>But I'm still unsure of the pretty way to get the parent path. 
  I thought of using sed to demove the "Uninstaller" part of this path, but is there an elegant way to get the path to Myapplication folder to delete it? </p>
  
  <p>Thank you</p>