I am running a remote shell script from a local shell script using ssh. Below is the code in my local shell script:
ssh userid@remote_server '/bin/bash' << EOF
if remote_shell_script.sh ; then
echo 'Script executed successfully'
else
echo 'Script failed'
fi
EOF
The above script is working fine. But I am not able to return a status code to a local shell script that I can use locally. I want to return a status code (0,1) inside the EOF..EOF here statements that I can capture in my local script and then take action accordingly. How can I do this?