Returning value from postgresql command on shell script

-A -t



-A
--no-align
Switches to unaligned output mode. (The default output mode is otherwise aligned.)




-t
--tuples-only
Turn off printing of column names and result row count footers, etc. This is equivalent to the \t command.


psql -A -t -c "SELECT 1"

Reference: http://www.postgresql.org/docs/9.0/static/app-psql.html

No comments:

Post a Comment