Again, this is just a discussion point. And I'm quite willing to admit defeat if most people don't think that it is worth the effort.
-1, at least per the example. I would not want "-U postgres" inside the file. I tend to rely on service entries, not environment variables, and wouldn't want to hard-code them either. While psql has grown more flow-control capabilities recently it is, in most cases, a support language for me, not a main entry point. Shell scripts merge the per-instance run-time environment I need with the behavior the script provides - merging that I find I need more often than not and don't miss the added overhead in the few cases where it is unnecessary.
David J.