dynamic postgres inside shell script not working
Three misunderstandings:


You cannot return data from a DO command.
You cannot SELECT without target in plpgsql code. That's what the error message tells you.
You don't need either for a simple SELECT statement. Just run the statement itself:




abc()
{
 $PG_CMD 'select * from customer'
}