On Sat, Sep 12, 2015 at 11:14:07AM +1000, Damien Miller wrote: > ssh server.example.com /usr/bin/do/something > r=$? > if [ $r -eq 0 ] ; then > echo success > elif [ $r -eq 255 ] ; then > echo ssh failed > else > echo command failed > fi ssh remoteserver exit 255 Hmm :-) exit(-1) aka exit(255) is a pretty standard "generic failure code" for many programs. The problem, really, is that "exit code" is the wrong thing to test for. x=`ssh remoteserver "echo CONNECTED && somecommand"` And then see if CONNECTED appears in the output to show successful connection. -- rgds Stephen _______________________________________________ openssh-unix-dev mailing list openssh-unix-dev@xxxxxxxxxxx https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev