#!/bin/bash

file="final2/merge.shp"
for i in $(ls *.shp)
        do
        if [ -f "$file" ]
                then
                echo "creating final22/merge.shp"
                ogr2ogr   -f "ESRI Shapefile" -a_srs  EPSG:4326  -geomfield MULTIPOLYGON  -update -append $file $i -nln merge
        else
               echo "merging……"
               ogr2ogr   -f "ESRI Shapefile"  -a_srs  EPSG:4326  -geomfield MULTIPOLYGON $file $i
               fi
        done
