This is a fix for the old bad code that had specified /home/$USER, for the location of the .pgpass file thus causing the script to throw an error when sudo was used, because the script was looking for the root user's .pgpass file. Since there is none--and there isn't supposed to be, I replaced all instances of /home/$USER with $HOME, which properly references the non-root user that's supposed to have the .pgpass file, even when sudo is used.
This is a fix for the old bad code that had specified
/home/$USER
, for the location of the.pgpass
file thus causing the script to throw an error whensudo
was used, because the script was looking for theroot
user's.pgpass
file. Since there is none--and there isn't supposed to be, I replaced all instances of/home/$USER
with$HOME
, which properly references the non-root user that's supposed to have the.pgpass
file, even whensudo
is used.