> On Mon, 28 Jun 2021 22:20:15 +1000 > Reuben ua Bríġ <u5644...@anu.edu.au> wrote: > > you cant interrupt sh in > > while do done > > not that it matters.
> Date: Fri, 2 Jul 2021 09:07:41 +1000 > From: Stuart Longland <stua...@longlandclan.id.au> > oninterrupt() { > echo "I was interrupted!" > exit 0 > } > > trap oninterrupt INT > while true; do > # Do something > sleep 10 > done you CAN interrupt while do sleep 0; done there is no need for exit, and it doesnt fix while do done or while :; do :; done if your shell needs something to not do. as an aside, using while do as a simple loop and putting sometest && break is a good way to NOT get tests wrong.