Thursday, 26 September 2013

Using shell script store POSTGRESQL query on a variable

Using shell script store POSTGRESQL query on a variable

I want to store following postgreSQL query result in a variable. I am
writing command on the shell script.
psql -p $port -c "select pg_relation_size ('tableName')" postgres
I need variable to save the result on a file. I have tried following but
it is not working
var= 'psql -p $port -c "select pg_relation_size ('tableName')" '

No comments:

Post a Comment