I want to run a command in a remote machine and overwrite my local bash script variable with this exit code. something like this:
ret=0
ssh -T [email protected] <<- EOSSH
cat / #This line will return an exit code 1
ret=$(( $ret|$? )
EOSSH
echo $ret #This variable print 0, but I want that print 1 because of the exit code
How can I do this?
$?reflecting the exit status of the command it ran remotely.