title: How to use CURL over SSH and get the file as well as the return value?
body: <p>I want to load a file from a clients webserver. This webserver is running local only. To get there I have to use ssh. I need the content as well as the return value (e.g. SSH connection broke, webserver down).</p>
  
  <p>What do I have to change? My first try:</p>
  
  <pre><code>#!/bin/bash
  
  RETURN=0
  CONTENT=""
  
  sshpass -p xxxxxx ssh root@172.17.1.33 "curl -X POST http://127.0.0.1:10000/status -H 'Content-Type: application/json' &gt; $CONTENT | bash; RETURN=$?"
  </code></pre>