#!/bin/bash function cleanup { echo "werde beendet" ## exit 1 } function hup { echo "setze mich zurueck" i=1 } trap hup 1 trap cleanup 2 3 9 15 i=0 while true do echo $i (( i++ )) sleep 3 done