# although exact value used when process is terminated by a signal=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 following script:

sleep 1000 &
pid=$!
kill -kill "${pid}"
wait "${pid}"
# shellcheck disable=SC2312
echo "${pid} was terminated by a SIG$(kill -l $?) signal."

# if the following sequence of commands is run in less than 31 seconds:
# shellcheck disable=SC2216
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 %%
