2021/02/03

macos term file "could not be opened because it is corrupt"

A ".term" file is a useful way to wrap up some command-line stuff, in a neat little package which requires no command-line knowledge, no luck in typing it perfectly, etc. - for some discussion, see these old Hints articles: Run shell scripts from GUI and Use partial .term files for quick… (note that the ExecutionString attribute can be anything you want…).

I was working on a new .term file, having started by duplicating a perfectly usable one - but getting this unhelpful error:

The file “test.term” could not be opened because it is corrupt.

It may have been incompletely copied from another machine.

And then _finally_ remembered that the file is XML, and ampersands have literal meaning, so must be "escaped", as in HTML, like so:

&

Hopefully, noting that here, saves someone (like myself) a bit of hair-tearing next time.