Exit code from remote linux bash execution

Aug 13, 2015 at 8:02 PM
Edited Aug 13, 2015 at 8:03 PM

A bash shell script executes code and then echoes text and the screen and exits with a specific exit code like:

echo "This is my text"
exit 1

RunCommand captures the string "This is my text". How do I capture the exit code of 1?