xref: /freebsd/crypto/openssh/regress/exit-status.sh (revision 406a584d7e80c2617dc035ede0d922215a12141c)
1#	$OpenBSD: exit-status.sh,v 1.8 2017/04/30 23:34:55 djm Exp $
2#	Placed in the Public Domain.
3
4tid="remote exit status"
5
6for s in 0 1 4 5 44; do
7	trace "status $s"
8	verbose "test $tid: status $s"
9	${SSH} -F $OBJ/ssh_proxy otherhost exit $s
10	r=$?
11	if [ $r -ne $s ]; then
12		fail "exit code mismatch for: $r != $s"
13	fi
14
15	# same with early close of stdout/err
16	${SSH} -F $OBJ/ssh_proxy -n otherhost exec \
17	    sh -c \'"sleep 2; exec > /dev/null 2>&1; sleep 3; exit $s"\'
18	r=$?
19	if [ $r -ne $s ]; then
20		fail "exit code (with sleep) mismatch for: $r != $s"
21	fi
22done
23