]> git.saurik.com Git - apple/shell_cmds.git/blob - sh/tests/execution/redir7.0
shell_cmds-216.60.1.tar.gz
[apple/shell_cmds.git] / sh / tests / execution / redir7.0
1 # $FreeBSD: head/bin/sh/tests/execution/redir7.0 220978 2011-04-23 22:28:56Z jilles $
2
3 failures=0
4
5 check() {
6 if [ "$2" != "$3" ]; then
7 echo "Failure at $1" >&2
8 failures=$((failures + 1))
9 fi
10 }
11
12 check $LINENO "$(trap "echo bye" EXIT; f() { :; }; f >/dev/null)" bye
13 check $LINENO "$(trap "echo bye" EXIT; f() { :; }; { f; } >/dev/null)" bye
14 check $LINENO "$(trap "echo bye" EXIT; f() { :; }; (f) >/dev/null)" bye
15 check $LINENO "$(trap "echo bye" EXIT; f() { :; }; (f >/dev/null))" bye
16 check $LINENO "$(${SH} -c 'trap "echo bye" EXIT; f() { :; }; f >/dev/null')" bye
17 check $LINENO "$(${SH} -c 'trap "echo bye" EXIT; f() { :; }; { f; } >/dev/null')" bye
18 check $LINENO "$(${SH} -c 'trap "echo bye" EXIT; f() { :; }; (f) >/dev/null')" bye
19 check $LINENO "$(${SH} -c 'trap "echo bye" EXIT; f() { :; }; (f >/dev/null)')" bye
20
21 exit $((failures > 0))