exit status of ssh?

Salvador Fandiño sfandino at yahoo.com
Sat Mar 19 18:39:47 EST 2011


On 03/18/2011 05:52 PM, Chris Quenelle wrote:
> On Friday March 18 9:41AM, Michael Loftis wrote:
>> On Thu, Mar 17, 2011 at 5:17 PM, Chris Quenelle
>> <chris.quenelle at oracle.com> wrote:
>>> The man page for ssh says that the exit status of ssh should
>>> be the exit status of the program that it runs.
>>>
>>> The session terminates when the command or shell on the remote machine
>>> exits and all X11 and TCP/IP connections have been closed. The exit sta‐
>>> tus of the remote program is returned as the exit status of ssh.
>>> ...
>>> ssh exits with the exit status of the remote command or with 255 if an
>>> error occurred.
>>>
>>>
>>> But it doesn't seem to work.
>>>
>>>
>>> % bash -c '"/bin/ls /foo"' ; echo $?
>>> bash: /bin/ls /foo: No such file or directory
>>> 127
>>>
>>> % ssh cryo bash -c '"/bin/ls /foo"' ; echo $?
>>> /bin/ls: /foo: No such file or directory
>>> 0

What happens when you log in cryo and run the first command there?

- Salva


More information about the openssh-unix-dev mailing list