title: How to pass local variables to ssh scope in bash script?
body: <p>I am writing the bash script, which has to perform some of the commands on remote server via ssh. The script has two major parts:</p>
  
  <p>Part 1:
  Using local variables $A and $B</p>
  
  <p>Part 2:
  Execute commands on remote server as follows:</p>
  
  <p><code>
  ssh -T user@servername  &lt;&lt; 'EOF'
  ...
  Using local variables $A and $B
  ...
  EOF
  </code></p>
  
  <p>The problem is that local variables $A and $B are not available within scope of ssh commands on remote server. As far as I understand the variables $A and $B outside and within ssh scope are not the same.</p>
  
  <p>So my question is how to pass local variables from bash script to ssh scope?
  One more note, the part 2 is pretty big so I can't use "one liner" after ssh.</p>
  
  <p>Thanks</p>