trap 捕捉信号量的小程序

#!/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

猜你喜欢

转载自blog.csdn.net/bluedraam_pp/article/details/80552073