Tell me more ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I tried to do this script:

#!/bin/bash
trap "echo trapped!" SIGUSR2
sleep 3s
kill -SIGUSR2 $$;
exit 0

and it works because it kills itself "from the inner". if i try this

#!/bin/bash
trap "echo trapped!" SIGUSR2
echo "PID: $$";
while true
do
sleep 1m
done
exit 0

and from another terminal i try to kill the script it seems don't accept the signal and so it does nothing. Why?

share|improve this question
3  
It will - just after a minute – DarkHeart Nov 4 '12 at 9:06

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.