title: How to read current directory from rebol script
body: <p>I am writing a script, located in ~/bin/ which is in my $PATH.
  I want to call this script from anywhere on the system (GNU/Linux, but this should not matter), and to read the current directory's contents.</p>
  
  <p>Unfortunately, the script always reads the ~/bin/ contents, that is the place where the script itself is located.</p>
  
  <p>Example:</p>
  
  <pre><code>  # pierre@autan: ~        &lt; 2013_07_20__11_18_57 &gt;
  cat ~/bin/test.r 
  #!/usr/bin/rebol
  rebol []
  print what-dir
  
    # pierre@autan: ~        &lt; 2013_07_20__11_18_57 &gt;
  pwd
  /home/pierre
  
    # pierre@autan: ~        &lt; 2013_07_20__11_18_57 &gt;
  test.r
  /home/pierre/bin/
  </code></pre>
  
  <p>The interpreter in /usr/bin/rebol is Rebol2/view.
  If I use a Rebol3, the result is the same, only it dereferences my ~/bin/ symlink:</p>
  
  <pre><code>  # pierre@autan: ~        &lt; 2013_07_20__11_18_57 &gt;
  cat ~/bin/test.r 
  #!/usr/bin/rebol3
  rebol []
  print what-dir
  
    # pierre@autan: ~        &lt; 2013_07_20__11_18_57 &gt;
  test.r
  /home/pierre/heaume_pierre/bin_scripts/
  
    # pierre@autan: ~        &lt; 2013_07_20__11_18_57 &gt;
  ll | grep bin
  lrwxrwxrwx  1 root   root         26 déc.  29  2010 bin -&gt; heaume_pierre/bin_scripts/
  </code></pre>
  
  <p>Now, from the console, it works as expected:</p>
  
  <pre><code>  # pierre@autan: ~        &lt; 2013_07_20__11_18_57 &gt;
  rebol
  &gt;&gt; print what-dir 
  /home/pierre/
  </code></pre>
  
  <p>I browsed through the documentation, but could not find anything helpful.</p>
  
  <p>Does anyone know how to achieve this?
  Note that this is certainly a very common issue, for anyone who would like to write some kind of utility.</p>