title: Source environment variables and execute bash before running local script on remote machine
body: <p>I'm trying to execute the remote local script with ssh connection. I've read a document about the syntax of it. But my issue is that, before running the script, I need to execute bash and source environment variables.</p>
  
  <p>This looks appropriate for me but it has not a source command :</p>
  
  <pre><code>ssh [user]@[server] 'bash -s' &lt; [local_script]
  </code></pre>
  
  <p>I've tried such a thing with EOF but it didn't work for me too :</p>
  
  <pre><code>#!/bin/bash
  /usr/bin/ssh  "$user@$$host" &lt;&lt;EOF
  bash -s
  source /dir/to/profile/.profile
  source /dir/to/env/set/env.sh
  /path/to/script/script.sh stop
  EOF
  </code></pre>
  
  <p>Do you have an idea for this type of implementation of remote commands ? I have to source profile before the environment settings otherwise it gives an exception. But the main problem is about source. </p>
  
  <p>Maybe it was an easy question but I don't have any ideas. Thank you in advance for your all answers.</p>