#!/bin/bash
trap 'myfunc' 2
function myfunc(){
read -p 'do you want to terminate this thread ' s
case $s in
'yes')
exit;
;;
'no')
;;
'*')
myfunc
;;
esac
}
i=0
while:
do
i=$((i+1))
echo $i
done