title: Strange PATH behavior in win-bash
body: <p>I installed win-bash on Windows 7 and I'm getting the following strange behavior.</p>
  
  <pre><code>bash$ cat C:/Home/.bashrc
  PATH="C:/Program\ Files/GnuWin32/bin:C:/Windows/system32"
  
  bash$ . C:/Home/.bashrc
  
  bash$ echo $PATH
  C:/Program\ Files/GnuWin32/bin:C:/Windows/system32
  
  bash$ which diff
  which: no diff in (.;C;\Program\ Files\GnuWin32\bin;C:\Windows\system32)
  
  bash$ which ls
  which: no ls in (.;C;\Program\ Files\GnuWin32\bin;C:\Windows\system32)
  </code></pre>
  
  <p>Why are the PATH values different?</p>
  
  <p>The PATH value returned by <code>which</code> contains <code>.:C;\Program\ Files\GnuWin32\bin</code></p>
  
  <p>Note:</p>
  
  <ul>
  <li>the ".:" in the beginning that does not exist in the bash PATH value.</li>
  <li>the "C;" (not C:) contains a semi-colon instead of a colon.</li>
  <li>the <code>which</code> PATH value has back slashes (<code>\\</code>) instead of forward slashes (<code>/</code>)</li>
  </ul>
  
  <p>Where is <code>which</code> sourcing these PATH values?<br>
  I can not find any other .bashrc or .profile or profile files anywhere on the machine.</p>
  
  <p>In addition,</p>
  
  <pre><code>bash$ diff file-abc.txt file-xyz.txt
  1c1
  &lt; abc
  ---
  \&gt; xyz
  
  bash$ ls file-abc.txt
  file-abc.txt
  </code></pre>
  
  <p>Both <code>diff</code> and <code>ls</code> work on the command line even though <code>which</code> can not find the <code>diff</code> or <code>ls</code> commands.</p>
  
  <p>Both <code>diff</code> and <code>ls</code> are located in <code>C:/Program\ Files/GnuWin32/bin</code>
  But <code>which</code> returns <code>C;\Program\ Files\GnuWin32\bin</code> (note C; not C:) which is why <code>which</code> can not find <code>ls</code> or <code>diff</code>.</p>
  
  <p>Again, where is <code>which</code> sourcing these PATH values?</p>
  
  <p>In my bash script named Try1.sh I have these lines.</p>
  
  <pre><code>\`diff $CURRENT_FILE $NEW_FILE\`
  \`ls $CURRENT_FILE\`
  The diff command fails with
  Try1.sh: 21c21: command not found
  </code></pre>
  
  <p>The <code>ls</code> command succeeds. Why?</p>
  
  <p>Both <code>diff</code> and <code>ls</code> live in the same PATH location <code>C:/Program\ Files/GnuWin32/bin</code>.</p>