clean_scratch mkfifo scratch/{pid,hup} ( # Create a zombie process echo >/dev/null & # Write the PID to scratch/pid echo $! >scratch/pid # Don't wait on the processes exec cat scratch/hup >/dev/null ) & # Kill cat on exit trap "echo >scratch/hup" EXIT # Read the zombie PID read -r pid /dev/null