I would like to know how to run
\du within a script, and output that to a file.
Something like the following:
psql <database connection> & \du > output_of_du.txt
I can find information about running
.sql files via psql, but I can't find information about running psql commands themselves.
I found the following whilst searching:
- https://stackoverflow.com/questions/35347368/unable-to-run-psql-command-from-within-a-bash-script - about running SQL not a PSQL command
- https://stackoverflow.com/questions/54619776/cannot-get-psql-command-to-run-in-bash-script - seems to be about running a
But they're not what I'm after.