I'm trying to make a bash script wait for a signal using and empty named pipe. I like this approach most than:
while : ; do sleep 1 ; done
because it's a kind of busy-waiting
I try:
trap 'echo SIGNAL!' INT
while true;
do
read
echo 'AFTER READ'
done < /tmp/fifo
where /tmp/fifo is the empty named pipe
and I get:
bash: /tmp/fifo: Interrupted system call
SIGNAL!
bash script aborts. How can I make the script keep looping when receiving the signal? Thanks