<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:12pt"><div>Placing a password in a script is somewhat less secure than something like:<br><span> <<a target="_blank" href="http://www.postgresql.org/docs/8.4/static/libpq-pgpass.html">http://www.postgresql.org/docs/8.4/static/libpq-pgpass.html</a>></span><br><br>(depending on which version postgres you are using).<br><br>HTH,<br><br>Greg Williamson<br><br></div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><br><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Dheeraj Chand <dheeraj@dheerajchand.com><br><b><span style="font-weight: bold;">To:</span></b> PostGIS Users Discussion <postgis-users@postgis.refractions.net><br><b><span
style="font-weight: bold;">Sent:</span></b> Sat, May 7, 2011 1:12:34 PM<br><b><span style="font-weight: bold;">Subject:</span></b> [postgis-users] shp2pgsql in a bash script question<br></font><br>
<div id="FE56LNW7B3" class="envelope" style="padding-top:1px;padding-right:5px;padding-bottom:1px;padding-left:5px;margin-bottom:3px;font-family:'Lucida Grande';"><br><span class="hidden" style="">:</span><span class="message" style="word-wrap:break-word;">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?</span></div><div class="event" style="color:rgb(170, 170, 170);text-align:center;padding-top:0px;padding-right:5px;padding-bottom:2px;padding-left:5px;word-wrap:break-word;font-family:'Lucida Grande';"><span class="timestamp hidden"
style="display:block;margin-top:0px;margin-left:5px;float:right;font-size:9px;color:rgb(136, 136, 136);word-wrap:normal;">[</span><span class="timestamp" style="display:block;margin-top:0px;margin-left:5px;float:right;font-size:9px;color:rgb(136, 136, 136);word-wrap:normal;">4:06pm</span><span class="timestamp hidden" style="display:block;margin-top:0px;margin-left:5px;float:right;font-size:9px;color:rgb(136, 136, 136);word-wrap:normal;">] </span><b><br></b></div><div class="event" style="text-align:left;color:rgb(170, 170, 170);padding-top:0px;padding-right:5px;padding-bottom:2px;padding-left:5px;word-wrap:break-word;font-family:'Lucida Grande';"><div class="event" style="text-align:left;padding-top:0px;padding-right:5px;padding-bottom:2px;padding-left:5px;word-wrap:break-word;"><b>#!/bin/bash</b></div><div class="event" style="text-align:left;padding-top:0px;padding-right:5px;padding-bottom:2px;padding-left:5px;word-wrap:break-word;"><b>for dir
in BG CD CONCITY COUNTY COUSUB LINEARWATER PRIMARYROADS PRISECROADS RAILS ROADS STATE SUBMCD TABBLOCK</b></div><div class="event" style="text-align:left;padding-top:0px;padding-right:5px;padding-bottom:2px;padding-left:5px;word-wrap:break-word;"><b>do</b></div><div class="event" style="text-align:left;padding-top:0px;padding-right:5px;padding-bottom:2px;padding-left:5px;word-wrap:break-word;"><b> ldir="$(echo ${dir} | tr 'A-Z' 'a-z')" >> download.log</b></div><div class="event" style="text-align:left;padding-top:0px;padding-right:5px;padding-bottom:2px;padding-left:5px;word-wrap:break-word;"><b>shp2pgsql -s 4326 -p ${dir}/tl_2010_01_${ldir}10 public.${ldir} | psql -h localhost -d geotest -U uname -W pass >> load.log</b></div><div class="event" style="text-align:left;padding-top:0px;padding-right:5px;padding-bottom:2px;padding-left:5px;word-wrap:break-word;"><b><br></b></div><div class="event"
style="text-align:left;padding-top:0px;padding-right:5px;padding-bottom:2px;padding-left:5px;word-wrap:break-word;"><b>done</b></div></div><div id="MV6GFDOW7B3" class="envelope" style="padding-top:1px;padding-right:5px;padding-bottom:1px;padding-left:5px;margin-bottom:3px;font-family:'Lucida Grande';"><span class="timestamp hidden" style="display:block;margin-top:0px;margin-left:5px;float:right;font-size:9px;color:rgb(136, 136, 136);word-wrap:normal;">[</span><span class="timestamp" style="display:block;margin-top:0px;margin-left:5px;float:right;font-size:9px;color:rgb(136, 136, 136);word-wrap:normal;">4:07pm</span><span class="timestamp hidden" style="display:block;margin-top:0px;margin-left:5px;float:right;font-size:9px;color:rgb(136, 136, 136);word-wrap:normal;">]</span><span class="hidden" style=""><br><span>Here is the script: <a target="_blank"
href="http://pastebin.com/prWLzEtk">http://pastebin.com/prWLzEtk</a>:</span></span></div></div></div>
</div></body></html>