Postgis data loader from shapefile bash shell script

Run this script in a directory of shp files to create STDOUT that will load them all into postgis

# jcz aug 24, 2005
# clip off the “.shp” file extensions before use
# drops existing shapes if they are the same name

for z in `ls *.shp
echo “shp2pgsql $z $z > $z.sql”
echo “psql -d -f $z.sql”