xref: /freebsd/bin/sh/tests/builtins/exec2.0 (revision e0c4386e7e71d93b0edc0c8fa156263fc4a8b0b6)
1
2failures=
3failure() {
4	echo "Error at line $1" >&2
5	failures=x$failures
6}
7
8(
9	exec -- >/dev/null
10	echo bad
11)
12[ $? = 0 ] || failure $LINENO
13(
14	exec -- ${SH} -c 'exit 42'
15	echo bad
16)
17[ $? = 42 ] || failure $LINENO
18(
19	exec -- /var/empty/nosuch
20	echo bad
21) 2>/dev/null
22[ $? = 127 ] || failure $LINENO
23
24test -z "$failures"
25