#!/bin/bash

# Our USR1 signal handler
function usr1_trap(){
    printf 'Here is the PID: %d\nExiting right-now!\n' $$
    # exit
}

# Register USR1 signal handler
trap usr1_trap USR1

printf 'Run this to stop me:\nkill -USR1 %d\n' $$

# Wait in background, not consuming CPU
while :; do
   sleep 9223372036854775807 & # int max (2^63 - 1)
   wait $!
done
