A discusion on the svn-ports-all mailing list [1] prompted me to propose an update to the sample script with some changes I've been using for years.
Instead of using shell expressions to detect postscript files, I'm leveraging file(1) to get a MIME type and take action based on that.
The updated example uses only parts included in the base install.
I think this makes up for a better example and a better actual script since it is cleaner and much more versatile. Extending it for a new format can be done by simply adding a new elif with the correct mime type.
For example the actual script I'm using also has a line to convert PDF files to postscript using ghostscript. That's because while my printer claims to be able to print from postscript directly, it actually crashes with most PDF files.
Hope this change can be accepted in the handbook.
[1] https://lists.freebsd.org/pipermail/svn-ports-all/2018-September/195057.html