# although the exact value used when a process is terminated by a signal is
# unspecified, if it is known that a signal terminated a process, a script can
# still reliably determine which signal by using kill as shown by the following
# script:

sleep 1000&
pid=$!
kill -kill "$pid"
wait "$pid"
echo "$pid was terminated by a SIG$(kill -l $?) signal."

# if the following sequence of commands is run in less than 31 seconds:

sleep 257 | sleep 31 &
jobs -l %%

# either of the following commands returns the exit status of the second sleep
# in the pipeline:

wait # <pid of sleep 31>
wait %%
