Pretty much the same concept as mine, cept mine uses a variable instead of a group, and a while loop instead of the -at1.

Didn't realise it til I re-read my code that the "unset" in my raw 303, would have to be dropped down beneath the next bracket (so that it's above the 'haltdef'.

Though, I suppose you could just change the "set" in mine to "set -u5"