exit-status.sh revision 1.3
1#	$OpenBSD: exit-status.sh,v 1.3 2002/02/16 01:09:47 markus Exp $
2#	Placed in the Public Domain.
3
4tid="remote exit status"
5
6for p in 1 2; do
7	for s in 0 1 4 5 44; do
8		trace "proto $p status $s"
9		ssh -$p -F $OBJ/ssh_proxy otherhost exit $s
10		r=$?
11		if [ $r -ne $s ]; then
12			fail "exit code mismatch for protocol $p: $r != $s"
13		fi
14
15		# same with early close of stdout/err
16		ssh -$p -F $OBJ/ssh_proxy -n otherhost \
17                	exec 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 protocol $p: $r != $s"
21		fi
22	done
23done
24