You can use "-c" option of psql client.
Ex.: psql -p 5000 -d database -c "SELECT * FROM
information_schema.tables WHERE table_schema = 'public'"
2006/10/27, Jon Horsman <horshaq(at)gmail(dot)com>:
>
> Hey,
>
> I'm trying to figure out how i can query the postgres information
> schema from a bourne shell script on linux. I need to know if a
> user/table exists. Does someone mind giving me a quick example of how
> this works, is this possible?
>
> Thanks,
>
> Jon.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>
--
William Leite Araújo