That's good to know. I didn't know how to do that with AppleScript.
I always like to know more than one way of doing something, so allow me to share this:
If you are dealing with PDFs, you can also use lpr
to print files in a shell script:
The simplest option is something like this:
/usr/bin/lpr "$1"
That assumes that the default printer is the one you want.
If you have a printer capable of printing two-sided copies, you can use this:
/usr/bin/lpr -o sides=two-sided-long-edge "$1"
There are lots of other features you can use with lpr
however I think it only works with PDFs because they're already "formatted" in a way that the printer can understand…but I might be wrong. (I suspect the AppleScript method works with more kinds of files, but I might be wrong about that, too.)