title: How to check if dir exists over ssh and return results to host machine
body: <p>I'm trying to establish an SSH connection and see if a directory exist, and if that directory exists I want to run commands on the local machine that made the SSH call.</p>
  
  <p>Here is what I've attempted:</p>
  
  <pre><code>if [ ssh -t username@ssh_server -d /directory ]
  then
  {
      commands....
  }
  fi
  </code></pre>
  
  <p>Is something like this possible?</p>