xref: /freebsd/bin/sh/tests/execution/redir7.0 (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1
2failures=0
3
4check() {
5	if [ "$2" != "$3" ]; then
6		echo "Failure at $1" >&2
7		failures=$((failures + 1))
8	fi
9}
10
11check $LINENO "$(trap "echo bye" EXIT; f() { :; }; f >/dev/null)" bye
12check $LINENO "$(trap "echo bye" EXIT; f() { :; }; { f; } >/dev/null)" bye
13check $LINENO "$(trap "echo bye" EXIT; f() { :; }; (f) >/dev/null)" bye
14check $LINENO "$(trap "echo bye" EXIT; f() { :; }; (f >/dev/null))" bye
15check $LINENO "$(${SH} -c 'trap "echo bye" EXIT; f() { :; }; f >/dev/null')" bye
16check $LINENO "$(${SH} -c 'trap "echo bye" EXIT; f() { :; }; { f; } >/dev/null')" bye
17check $LINENO "$(${SH} -c 'trap "echo bye" EXIT; f() { :; }; (f) >/dev/null')" bye
18check $LINENO "$(${SH} -c 'trap "echo bye" EXIT; f() { :; }; (f >/dev/null)')" bye
19
20exit $((failures > 0))
21