summary refs log tree commit diff
path: root/bin/cash/tests/builtins/exec2.0
blob: 9b29bd5d950f02ff2ae5ea0949f2c62d3c6a6c3b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# $FreeBSD: releng/12.0/bin/sh/tests/builtins/exec2.0 213738 2010-10-12 18:20:38Z obrien $

failures=
failure() {
	echo "Error at line $1" >&2
	failures=x$failures
}

(
	exec -- >/dev/null
	echo bad
)
[ $? = 0 ] || failure $LINENO
(
	exec -- ${SH} -c 'exit 42'
	echo bad
)
[ $? = 42 ] || failure $LINENO
(
	exec -- /var/empty/nosuch
	echo bad
) 2>/dev/null
[ $? = 127 ] || failure $LINENO

test -z "$failures"