title: Unable to test whether a file exists in Bash
body: <p>Consider the following Bash script:</p>
  
  <pre><code>function dosomething {
      local fname="~/.bash_profile"
      if [[ -f "$fname" ]]; then
          echo "proceeding"
      else
          echo "skipping"
      fi
  }
  
  dosomething
  </code></pre>
  
  <p>I always get "skipped" although I know that ~/.bash_profile exists. Why?</p>