In Bash 5 I ran into a situation where I want to do the following:
trap 'echo trapped!' USR1
while true; do kill -SIGUSR1 $$; sleep 1; done &
But I have to press enter on keyboard every time the signal is sent to make the trap code continue.
Actually I expect the trap to be executed without any keyboard interaction.
EDIT:
Finally I got it working like this:
trap 'echo trapped!' USR1
while true; do kill -USR1 $$; kill -INT $$; sleep 1; done &
But I consider the solution as workaround and not as answer.