title: how to return a variable from one shell script to another script
body: <p>I have 2 shell scripts called script1.sh (executes on local server ) and script2.sh (executes on remote server which i am passing it to ssh command). and my script1.sh is connecting to unix server and and executing script2.sh as below.</p>
  
  <pre><code>declare RESULT=$(sshpass -p 'password' ssh username@1.2.3.4 "bash -s" &lt; ./script2.sh )
  </code></pre>
  
  <p>and script2.sh does some calculations and returns some variable to calling script i.e script1.sh</p>
  
  <pre><code>#!/bin/sh
  declare var1="fgte"
  return var1
  </code></pre>
  
  <p>I want to return var1 from script2.sh which is executing on server and should return some value to script1.sh. How can i do that? I need to read the value of var1 in script1.sh. Please help me.</p>