I have a bunch of log files and I want to do a tail -f
on them in a loop such that when I press Ctrl-C, the current tail -f
gets killed and I proceed to the next log file:
for log in *.log; do
printf '%s\n' "Tailing log '$log'; press Ctrl-C to skip to the next"
tail -f "$log"
done
The issue is that pressing Ctrl-C kills the loop itself. How can I restrict the interrupt signal to just the child process, tail
in this case?