I have this little script. When I start it and the terminal has the focus Ctrl+C stops feh and then the while loop starts feh again. I am expecting that, as long as the terminal(!) has the focus, Ctrl+C interrupts the while loop and kills feh as well.
#!/bin/bash
sleep 2
while true; do
feh --cycle-once -zD $1 *.png
done
Can someone tell me how I can get that preferred behavior here?
Best Answer
Try this:
This way, the cycle will end when feh exits with a nonzero status (as it does when you terminate it).