escaping space in shell script path

Solution 1:

You can either quote or escape the space when you define the variable, but then you must also double-quote it when you use it:

#!/bin/bash -x
PGHOME="/Applications/pgAdmin 4.app/Contents/SharedSupport"
"$PGHOME/psql" --username postgres -c "drop database $1"
^            ^
|            |