title: Passing a string value will fail to find the file
body: <p>I write a shell which will try to collect a file from the file path into current directory if it exists:</p>
  
  <pre><code>collect_file() {
    fpath=$1
    echo $fpath
    if [ -e $fpath ]; then
  
      fname=`basename $fpath`
      `cp $1 $fname`
      retval=$?
      if [ $retval == 0 ]; then
        echo "Collect file '$fpath'"
      else
        echo "Error: fail to copy file '$fpath'"
      fi
  
    else
      echo "Error: file '$fpath' not found"
    fi  
  }
  </code></pre>
  
  <p>Now, if I pass a bare value <code>~/.gitconfig</code>, it will succeed, but when I pass a string value <code>"~/.gitconfig"</code>, it will fail.</p>
  
  <pre><code>collect_file ~/.gitconfig        # will succeed to copy the file
  collect_file "~/.gitconfig"      # will fail
  </code></pre>
  
  <p>Shows:</p>
  
  <pre><code># results for bare value
  /Users/Xaree/.gitconfig
  Collect file '/Users/Xaree/.gitconfig'
  
  # results for string value
  ~/.gitconfig
  Error: file '~/.gitconfig' not found
  </code></pre>
  
  <p>Why and how can I fix it?</p>