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