title: Passing variables in remote ssh command in shell script
body: <p>Right now I have this file so far...</p>
  
  <pre><code>#!/usr/bin/env bash
  
  DIRECTORY=$1
  
  ssh root@example.com "$( cat &lt;&lt;'EOT'
  cd /web/$DIRECTORY || exit
  pwd
  unset GIT_DIR
  git log --oneline -n 10 --decorate
  git branch
  EOT
  )";
  </code></pre>
  
  <p>Why does the pwd just print out "/web/"? It doesn't actually seem to be using my variable. Then all the git commands throw errors about being in the web directory.</p>
  
  <p>If I have it echo $DIRECTORY out before ssh-ing, it echos out my variable, but refuses to pass it through to the ssh command?</p>