0

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?

2
  • Mind, the ssh command itself will have a $? reflecting the exit status of the command it ran remotely. Commented Sep 24, 2020 at 18:25
  • 1
    You ask how to set variables generally, but in your specific case you can more easily get the exit code via ssh Commented Sep 24, 2020 at 18:26

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.