title: How have both local and remote variable inside an SSH command
body: <p>How can I have both local and remote variable in an ssh command? For example in the following sample code:</p>
  
  <pre><code>A=3;
  ssh host@name "B=3; echo $A; echo $B;"
  </code></pre>
  
  <p>I have access to A but B is not accessible.</p>
  
  <p>But in the following example:</p>
  
  <pre><code>A=3;
  ssh host@name 'B=3; echo $A; echo $B;'
  </code></pre>
  
  <p>I don't have A and just B is accessible.</p>
  
  <p>Is there any way that both A and B be accessible?</p>