title: How to use a bash profile function to connect remotely and access the remote terminal
body: <p>I want to write a <code>bash function</code> locally, so when I run this function the first command is to get connected to an ubuntu Remote Desktop through <code>ssh</code>.</p>
  
  <p>In a nutshell:</p>
  
  <pre><code>    my_func () {
      ssh blah blah blah;
      echo $HOME;
  }
  </code></pre>
  
  <p>The desired output is sth like <code>/home/ubuntu</code>, but I get nothing. So I have the impression that <code>my_func</code> works only locally, because when I exit the Remote Desktop then I get my local <code>$HOME</code> directory. </p>