Unix Programming - Feeding psql results into an array

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > December 2006 > Feeding psql results into an array





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Feeding psql results into an array
Fuzzygoth

2006-12-18, 7:22 am

I am currently trying to write a backup application for postgres, the
backups
will be handled by a shell script. I have been having some trouble
assigning
the db names returned to the script from a psql statement into an array
that
I can later loop though. If I hardcode the database names into the
script EG:

DATABASES=(db_a, db_b, db_c)

the code loops through and does the backup flawlessly, But i want the
script
to interrogate the database and find out (based on the backup app
table) which
db's are marked for backup (done using a boolean value in the database)
and
then only call back the items required for the download.

I am still relitively new to shell scripting and this is my 4th script
and second
revision of our backup system so any advice or good resouces would be
welcomed.


Many Thanks
David Phillips

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com