summary refs log tree commit diff
path: root/bin/cash/tests/builtins/exec1.0
blob: 19f2eef1b3fcb2287157cbd90169ae92b0908b2b (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/exec1.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"