exit status of ssh?

Peter Stuge peter at stuge.se
Sat Mar 19 05:20:28 EST 2011


Chris Quenelle wrote:
>> try ssh cryo /bin/ls /foo and see what your exit code is then.
>
> Good point.  But the results are the same.

It works for me.

$ ls /foo; echo $?
ls: cannot access /foo: No such file or directory
2
$ ssh foo ls /foo; echo $?
ls: /foo: No such file or directory
2
$ ssh -v box ls /foo; echo $?
OpenSSH_5.4p1, OpenSSL 0.9.8k 25 Mar 2009
..
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.0
..
debug1: Sending command: ls /foo
ls: /foo: No such file or directory
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2472, received 1920 bytes, in 0.4 seconds
Bytes per second: sent 6804.5, received 5285.0
debug1: Exit status 2
2
$ 


//Peter


More information about the openssh-unix-dev mailing list