#! /usr/bin/bash on_hup() { echo "hup handler" } trap on_info SIGHUP my_pid=$! echo "${my_pid}" while true; do sleep 1 done