#!/bin/bash trap "echo interrupted" 2 for i in {1..5} do sleep 1 echo Waiting $i ... done