I would like to
- copy a file to the clipboard in terminal (as a reference like Finder does it) and then
- when writing an email, paste it into Mail as an attachment (
CMD + V).
I posted an example solution below but I'd prefer a script that does not need to open Finder.