[postgis-users] shp2pgsql in a bash script question
Greg Williamson
gwilliamson39 at yahoo.com
Sat May 7 13:24:47 PDT 2011
Placing a password in a script is somewhat less secure than something like:
<http://www.postgresql.org/docs/8.4/static/libpq-pgpass.html>
(depending on which version postgres you are using).
HTH,
Greg Williamson
________________________________
From: Dheeraj Chand <dheeraj at dheerajchand.com>
To: PostGIS Users Discussion <postgis-users at postgis.refractions.net>
Sent: Sat, May 7, 2011 1:12:34 PM
Subject: [postgis-users] shp2pgsql in a bash script question
:I have the world's dumbest question today. I am running a bash script that goes
through several directories (and each of their several subdirectories) of
shapefiles to run shp2pgsql and put them into the correct PSQL schema and
table. I'd like to be able to set it and forget it, so to speak, but each time,
the shell is prompting me for the user's password. Is there a way to hardcode
the password in?
[
4:06pm
]
#!/bin/bash
for dir in BG CD CONCITY COUNTY COUSUB LINEARWATER PRIMARYROADS PRISECROADS
RAILS ROADS STATE SUBMCD TABBLOCK
do
ldir="$(echo ${dir} | tr 'A-Z' 'a-z')" >> download.log
shp2pgsql -s 4326 -p ${dir}/tl_2010_01_${ldir}10 public.${ldir} | psql -h
localhost -d geotest -U uname -W pass >> load.log
done
[
4:07pm
]
Here is the script: http://pastebin.com/prWLzEtk:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110507/469a55cc/attachment.html>
More information about the postgis-users
mailing list