1*773d7cabSdjm# $OpenBSD: exit-status.sh,v 1.8 2017/04/30 23:34:55 djm Exp $ 225a4fdfeSmarkus# Placed in the Public Domain. 325a4fdfeSmarkus 455154775Smarkustid="remote exit status" 555154775Smarkus 655154775Smarkusfor s in 0 1 4 5 44; do 7*773d7cabSdjm trace "status $s" 8*773d7cabSdjm verbose "test $tid: status $s" 9*773d7cabSdjm ${SSH} -F $OBJ/ssh_proxy otherhost exit $s 1055154775Smarkus r=$? 1155154775Smarkus if [ $r -ne $s ]; then 12*773d7cabSdjm fail "exit code mismatch for: $r != $s" 1355154775Smarkus fi 1455154775Smarkus 1555154775Smarkus # same with early close of stdout/err 16*773d7cabSdjm ${SSH} -F $OBJ/ssh_proxy -n otherhost exec \ 17*773d7cabSdjm sh -c \'"sleep 2; exec > /dev/null 2>&1; sleep 3; exit $s"\' 1855154775Smarkus r=$? 1955154775Smarkus if [ $r -ne $s ]; then 20*773d7cabSdjm fail "exit code (with sleep) mismatch for: $r != $s" 2155154775Smarkus fi 2255154775Smarkusdone 23