xref: /freebsd/bin/sh/tests/execution/killed2.0 (revision d9a9f23d0b3f1676d5656b76301341c0037d15b7)
1# Most shells print a message when a foreground job is killed by a signal.
2# POSIX allows this, provided the message is sent to stderr, not stdout.
3# Some trickery is needed to capture the message as redirecting stderr of
4# the command itself does not affect it. The colon command ensures that
5# the subshell forks for ${SH}.
6
7exec 3>&1
8r=`(${SH} -c 'kill $$'; :) 2>&1 >&3`
9[ -n "$r" ]
10