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.
declare RESULT=$(sshpass -p 'password' ssh [email protected] "bash -s" < ./script2.sh )
and script2.sh does some calculations and returns some variable to calling script i.e script1.sh
#!/bin/sh
declare var1="fgte"
return var1
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.
echo.