Thank you Bruno! You led me in the right direction.
One thing to notice is that setting the database name with the environment variable PGDATABASE does not work (I suspect this is not the expected behavior). The obvious workaround was to edit the script and hard code the database name.
It would be great if the script prompted for each of the variables, maybe displaying the defaults with brackets in each prompt, so the user could hit enter to accept the proposed values or type the one it wishes to use.
If setting environment variables is the recommended way to use the script, maybe the documentation at the
Updating Bareos Tutorial should reflect that.
Anyway, thanks again for your help!