Great, my script was being unreliable because on Ubuntu 24.04.4 bash version 5.2.21(1)-release the test [ -n "$THINGY" ] was sometimes returning false for an empty string, but [ 0 -eq ${#THINGY} ] is reliable.
As in I have a loop running the same code for a dozen inputs and about half the time it inappropriately skips the section. For no reason I can find. And no, it's not 100% reliable WHICH ones fail if I run it twice.
There are reasons I no longer use ubuntu, but alas other people do...
