Hi,
There is a tiny addition to both scripts. I redirect any error to the nirvana.
If an error occurs like you call 'defaultsread <domain> <key> and the key doesn't exist an empty string will be returned instead of an error message.
I think this is the best way (?)
Best,
Hans