title: $PWD vs. pwd regarding portability
body: <p>I'm writing a shell script which parses the path of the current working directory (printing a like of all basenames above the current directory).</p>
  
  <p>So far, I've been using the environment variable <code>PWD</code> to parse the path but I wonder if</p>
  
  <ul>
  <li>I can count on <code>PWD</code> to be always set</li>
  <li>to give the same result on every platform</li>
  </ul>
  
  <p>Would it possibly be better to use the <code>pwd</code> shell-builtin? I need this script to run on as many platforms as possible, so I just wondered...</p>