I exexcute
$ ssh remotehost "exit 1"
$ echo $?
0
The result is 0 and not 1.
I have read here on stackoverflow, that it should be 1. What is going wrong? TIA!
Update (Solution):
ssh
is a function on that site, and there is one command executed after the ssh call.
Executing /usr/bin/ssh remotehost "exit 1"
, the exit-code
is 1
.
Thanks to @jeb :)
Some hints to find such problems.
type ssh
, which ssh
or use \ssh remotehost "exit 1"
false
followed by echo $?
should output a 1
echo $PROMPT_COMMAND
shows if there is an user defined prompt function active, unset itssh -vvv remotehost "exit 1"
it should show the exitcode in the last debug line, something like debug1: Exit status 1