<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.17097" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=515290912-09052011><FONT face=Arial
color=#0000ff size=2>The easiest way is to lauch pgAdmin and connect to the
server. </FONT></SPAN><SPAN class=515290912-09052011><FONT face=Arial
color=#0000ff size=2>At the first time, a little window will be prompted asking
you password for the user postgres, and once you will have entered this
password, just check the option "Store password"... And you will never be
asked to enter this password anymore when you will launch your batch
file.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=515290912-09052011><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=515290912-09052011><FONT face=Arial
color=#0000ff size=2>Hope this help,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=515290912-09052011><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=515290912-09052011><FONT face=Arial
color=#0000ff size=2>Marc-André</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=fr dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>De :</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>De la part de</B> Carl
Anderson<BR><B>Envoyé :</B> 7 mai 2011 17:43<BR><B>À :</B> PostGIS
Users Discussion<BR><B>Objet :</B> Re: [postgis-users] shp2pgsql in a bash
script question<BR></FONT><BR></DIV>
<DIV></DIV>You would only have to enter the password once if you changed your
script like this.
<DIV><BR></DIV>
<DIV><SPAN class=Apple-style-span
style="COLOR: rgb(170,170,170); FONT-FAMILY: 'Lucida Grande'">
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B>#!/bin/bash</B></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B><BR></B></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B>(
</B></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B>for
dir in BG CD CONCITY COUNTY COUSUB LINEARWATER PRIMARYROADS PRISECROADS RAILS
ROADS STATE SUBMCD TABBLOCK</B></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B>do</B></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B>
ldir="$(echo ${dir} | tr 'A-Z' 'a-z')" >>
download.log</B></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B>shp2pgsql
-s 4326 -p ${dir}/tl_2010_01_${ldir}10 public.${ldir}</B></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B><BR></B></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B>done
) </B><B> | psql -h localhost -d geotest -U uname -W
>> load.log </B></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B><BR></B></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B><BR></B></DIV></SPAN>C.</DIV>
<DIV><BR></DIV>
<DIV><BR>
<DIV class=gmail_quote>On Sat, May 7, 2011 at 4:12 PM, Dheeraj Chand <SPAN
dir=ltr><<A
href="mailto:dheeraj@dheerajchand.com">dheeraj@dheerajchand.com</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<DIV style="WORD-WRAP: break-word">
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; MARGIN-BOTTOM: 3px; PADDING-BOTTOM: 1px; PADDING-TOP: 1px; FONT-FAMILY: 'Lucida Grande'"><BR><SPAN>:</SPAN><SPAN
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
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; COLOR: rgb(170,170,170); PADDING-TOP: 0px; FONT-FAMILY: 'Lucida Grande'; TEXT-ALIGN: center; WORD-WRAP: break-word"><SPAN
style="MARGIN-TOP: 0px; DISPLAY: block; FONT-SIZE: 9px; FLOAT: right; MARGIN-LEFT: 5px; COLOR: rgb(136,136,136); WORD-WRAP: normal">[</SPAN><SPAN
style="MARGIN-TOP: 0px; DISPLAY: block; FONT-SIZE: 9px; FLOAT: right; MARGIN-LEFT: 5px; COLOR: rgb(136,136,136); WORD-WRAP: normal">4:06pm</SPAN><SPAN
style="MARGIN-TOP: 0px; DISPLAY: block; FONT-SIZE: 9px; FLOAT: right; MARGIN-LEFT: 5px; COLOR: rgb(136,136,136); WORD-WRAP: normal">] </SPAN><B><BR></B></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; COLOR: rgb(170,170,170); PADDING-TOP: 0px; FONT-FAMILY: 'Lucida Grande'; TEXT-ALIGN: left; WORD-WRAP: break-word">
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B>#!/bin/bash</B></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B>for
dir in BG CD CONCITY COUNTY COUSUB LINEARWATER PRIMARYROADS PRISECROADS RAILS
ROADS STATE SUBMCD TABBLOCK</B></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B>do</B></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B>
ldir="$(echo ${dir} | tr 'A-Z' 'a-z')" >>
download.log</B></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; 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
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B><BR></B></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 0px; TEXT-ALIGN: left; WORD-WRAP: break-word"><B>done</B></DIV></DIV>
<DIV
style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; MARGIN-BOTTOM: 3px; PADDING-BOTTOM: 1px; PADDING-TOP: 1px; FONT-FAMILY: 'Lucida Grande'"><SPAN
style="MARGIN-TOP: 0px; DISPLAY: block; FONT-SIZE: 9px; FLOAT: right; MARGIN-LEFT: 5px; COLOR: rgb(136,136,136); WORD-WRAP: normal">[</SPAN><SPAN
style="MARGIN-TOP: 0px; DISPLAY: block; FONT-SIZE: 9px; FLOAT: right; MARGIN-LEFT: 5px; COLOR: rgb(136,136,136); WORD-WRAP: normal">4:07pm</SPAN><SPAN
style="MARGIN-TOP: 0px; DISPLAY: block; FONT-SIZE: 9px; FLOAT: right; MARGIN-LEFT: 5px; COLOR: rgb(136,136,136); WORD-WRAP: normal">]</SPAN><SPAN><BR>Here
is the script: <A href="http://pastebin.com/prWLzEtk"
target=_blank>http://pastebin.com/prWLzEtk</A>:</SPAN></DIV></DIV><BR>_______________________________________________<BR>postgis-users
mailing list<BR><A
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</A><BR><A
href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR><BR></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR>Carl Anderson, GISP<BR> <BR><A
href="mailto:canderson@spatialfocus.com"
target=_blank>canderson@spatialfocus.com</A><BR><A
href="mailto:carl.anderson@vadose.org"
target=_blank>carl.anderson@vadose.org</A><BR><BR></DIV></BODY></HTML>