title: SSH heredoc: bash prompt
body: <p>I am attempting to write a shell script which SSHs into a server and then prompts the user to enter a file/folder.</p>
  
  <pre><code>ssh $SERVER &lt;&lt;EOF
  cd downloads/
  read -e -p "Enter the path to the file: " FILEPATH
  echo $FILEPATH
  eval FILEPATH="$FILEPATH"
  
  echo "Downloading $FILEPATH to $CLIENT"
  EOF
  </code></pre>
  
  <p>I am using heredoc instead of double quotes after the SSH to execute these commands because my shell script is rather large and I don't want to be escaping every double quote.</p>
  
  <p>When I was using double quotes, the prompt worked fine. However, now that I am using heredoc, the prompt no longer works.</p>
  
  <p>What can I do to get the prompt to work with heredoc? And if not, is there any way I layout my script so that the prompt does work without wrapping everything in double quotes and escaping, like so:</p>
  
  <pre><code>ssh $SERVER "
  cd downloads/
  read -e -p \"Enter the path to the file: \" FILEPATH
  echo $FILEPATH
  eval FILEPATH=\"$FILEPATH\"
  
  echo \"Downloading $FILEPATH to $CLIENT\"
  exit
  "
  </code></pre>