xref: /freebsd/bin/sh/tests/builtins/trap16.0 (revision f126890ac5386406dadf7c4cfa9566cbb56537c5)
1
2traps=$(${SH} -c 'trap "echo bad" 0; trap - 0; trap')
3[ -z "$traps" ] || exit 1
4traps=$(${SH} -c 'trap "echo bad" 0; trap "" 0; trap')
5expected_traps=$(${SH} -c 'trap "" EXIT; trap')
6[ "$traps" = "$expected_traps" ] || exit 2
7traps=$(${SH} -c 'trap "echo bad" 0; trap 0; trap')
8[ -z "$traps" ] || exit 3
9traps=$(${SH} -c 'trap "echo bad" 0; trap -- 0; trap')
10[ -z "$traps" ] || exit 4
11traps=$(${SH} -c 'trap "echo bad" 0 1 2; trap - 0 1 2; trap')
12[ -z "$traps" ] || exit 5
13traps=$(${SH} -c 'trap "echo bad" 0 1 2; trap "" 0 1 2; trap')
14expected_traps=$(${SH} -c 'trap "" EXIT HUP INT; trap')
15[ "$traps" = "$expected_traps" ] || exit 6
16traps=$(${SH} -c 'trap "echo bad" 0 1 2; trap 0 1 2; trap')
17[ -z "$traps" ] || exit 7
18traps=$(${SH} -c 'trap "echo bad" 0 1 2; trap -- 0 1 2; trap')
19[ -z "$traps" ] || exit 8
20