#! /usr/bin/bash on_exit() { echo "Programmende signalisiert." } on_debug() { echo "debug handler" echo "[DEBUG] counter=${counter}" } trap on_exit exit trap on_debug debug sleep 10 #counter=0 #while true; do # let counter++ # echo "running..." #done