xref: /freebsd/bin/sh/tests/execution/killed2.0 (revision 1719886f6d08408b834d270c59ffcfd821c8f63a)
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