PGPATH=`echo$0| sed 's,/[^/]*$,,'`# (dirname command is not portable)
PGPATH=`echo"$0"| sed 's,/[^/]*$,,'`# (dirname command is not portable)
else
# look for it in PATH ('which' command is not portable)
for dir in `echo"$PATH"| sed 's/:/ /g'`;do
@ -78,7 +78,7 @@ globals_only=
while["$#" -gt 0];do
case$1 in
case"$1" in
--help)
usage=t
break
@ -94,7 +94,7 @@ while [ "$#" -gt 0 ] ; do
connectopts="$connectopts$1"
;;
--host=*)
connectopts="$connectopts -h "`echo$1| sed 's/^--host=//'`
connectopts="$connectopts -h `echo $1 | sed 's/^--host=//'`"
;;
--port|-p)
connectopts="$connectopts -p $2"
@ -103,7 +103,7 @@ while [ "$#" -gt 0 ] ; do
connectopts="$connectopts$1"
;;
--port=*)
connectopts="$connectopts -p "`echo$1| sed 's/^--port=//'`
connectopts="$connectopts -p `echo $1 | sed 's/^--port=//'`"
;;
--user|--username|-U)
connectopts="$connectopts -U $2"
@ -112,7 +112,7 @@ while [ "$#" -gt 0 ] ; do
connectopts="$connectopts$1"
;;
--user=*|--username=*)
connectopts="$connectopts -U "`echo$1| sed 's/^--user[^=]*=//'`
connectopts="$connectopts -U `echo $1 | sed 's/^--user[^=]*=//'`"
;;
-W|--password)
connectopts="$connectopts -W"
@ -125,6 +125,10 @@ while [ "$#" -gt 0 ] ; do
-g|--globals-only)
globals_only=yes
;;
-F*|--format=*|-f|--file=*|-t|--table=*)
echo"pg_dump can not process option $1, exiting" 1>&2
exit1
;;
*)
pgdumpextraopts="$pgdumpextraopts$1"
;;
@ -214,12 +218,9 @@ exec 4<&0
# We skip databases marked not datallowconn, since we'd be unable to
# connect to them anyway (and besides, we don't want to dump template0).
DATABASES=""
$PSQL -d template1 -At -F ' '\
-c "SELECT datname, coalesce(usename, (select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), pg_encoding_to_char(d.encoding), datistemplate, datpath FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) WHERE datallowconn ORDER BY 1;"|\