freebsd-dev/bin/sh/tests/execution/redir6.0

22 lines
675 B
Plaintext
Raw Normal View History

# $FreeBSD$
failures=0
check() {
if [ "$2" != "$3" ]; then
echo "Failure at $1" >&2
failures=$((failures + 1))
fi
}
check $LINENO "$(trap "echo bye" EXIT; : >/dev/null)" bye
check $LINENO "$(trap "echo bye" EXIT; { :; } >/dev/null)" bye
check $LINENO "$(trap "echo bye" EXIT; (:) >/dev/null)" bye
check $LINENO "$(trap "echo bye" EXIT; (: >/dev/null))" bye
check $LINENO "$(${SH} -c 'trap "echo bye" EXIT; : >/dev/null')" bye
check $LINENO "$(${SH} -c 'trap "echo bye" EXIT; { :; } >/dev/null')" bye
check $LINENO "$(${SH} -c 'trap "echo bye" EXIT; (:) >/dev/null')" bye
check $LINENO "$(${SH} -c 'trap "echo bye" EXIT; (: >/dev/null)')" bye
exit $((failures > 0))