Re: [GENERAL] shell script to populate array values

2006-12-14 Thread Paul Silveira
Thanks again Susan. I agree that this is truly a shell scripting question. I placed it here because I was hoping that someone (like yourself :) ) would have easy examples of other things they've done in the psql space. I actually did want to insert a litteral version of the variable. I found

Re: [GENERAL] shell script to populate array values

2006-12-12 Thread Paul Silveira
Thanks Susan... I really appreciate your answer and helping me do what I wanted to do... I posted the code I was working on here... http://people.planetpostgresql.org/paul/ It's a pretty cool script and although it's not even done yet, I'm sure it could be useful to anyone wanting to do the

Re: [GENERAL] shell script to populate array values

2006-12-12 Thread Paul Silveira
I wonder if I could ask another question on this thread... How would i get the latest ID value of a table in psql and then use that value as part of an insert statement... For example... I would like ot declare a variable in a shell script and then use that value in the insert statement later

Re: [GENERAL] shell script to populate array values

2006-12-12 Thread SCassidy
What's stopping you from using the variable? It works fine for me. The only problem I see is that you are quoting an integer value (SELECT '$SERVERCOLLECTIONTIMEID', column1 FROM mytable;) for no reason (leave off the single quotes around $SERVERCOLLECTIONTIMEID), although it does not seem to

[GENERAL] shell script to populate array values

2006-12-11 Thread Paul Silveira
Hello, I would like to create a shell script that would populate two variables with the return of a SELECT statement that would return two attributes... For example... #!/bin/bash SERVER_NAMES=`psql Admin -Upostgres -hMYSERVER -t -cSELECT servername, instanceport from server where

Re: [GENERAL] shell script to populate array values

2006-12-11 Thread SCassidy
You should be able to use something like this in a bash script: psql -U postgres -hMYSERVER --quiet --no-align --field-separator ' ' -t -c SELECT servername,instanceport from server where serverclass = 3 and isactive = 'True' Admin | while read -a SVRDATA ;do echo name: ${SVRDATA[0]} port: