PGUSER=postgres
PGPASSWORD=xxxx
export PGUSER PGPASSWORD
pgsql -d foo -A -q -c "SELECT * FROM hoge";

こんな感じでいけるんじゃないの?