# /bin/bash


# --------------------------------------------------------------
#
# Executes a psql command and prints the value of
# the first column of first row of the resultset.
#
# Author:  Zlatko Michailov
# Created: 12-Dec-2003
# Updated: 18-Dec-2003
# Updated: 17-Jan-2004
#
# --------------------------------------------------------------

psql -q "$@" | gawk '{ if ( NR == 3 ) print $1; if ( NR > 3 ) exit }'
