title: Using value returned of script executed on remote host
body: <p>So I am executing this code on the local host which is accessing a remote host and executing another script:</p>
  
  <pre><code>count=$(ssh -i /home/ubuntu/***** "sh /home/ubuntu/michael/LogScript/backUpLog.sh "$1" "$2" "$3"")
  echo "$count"
  exit "$count"
  </code></pre>
  
  <p>And this is the code it is remotely connecting to and running:</p>
  
  <pre><code>count=$(grep "^$(date -d -"$1"minute +'%Y-%m-%d %H')" /var/log/*****/*****.log | wc -l)
  if [ "$count" -ge "$2" -a "$count" -lt "$3" ]
  then
      exit 1
  fi  
  if [ "$count" -ge "$3" ]
  then 
      exit 2
  fi
  exit 0
  </code></pre>
  
  <p>The ssh is working correctly as I have testing with very simple scripts, but when I run the above I get <code>exit: 3: Illegal number:</code> It doesn't say anything more than this. Is it because of the way I am calling count in the local script?</p>