[GRASS-SVN] r46617 - in grass/branches/releasebranch_6_4/scripts: db.out.ogr g.mremove i.image.mosaic i.oif r.mask r.plane v.build.all v.convert.all v.db.reconnect.all v.dissolve v.in.sites.all v.report

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jun 8 19:39:07 EDT 2011


Author: neteler
Date: 2011-06-08 16:39:07 -0700 (Wed, 08 Jun 2011)
New Revision: 46617

Modified:
   grass/branches/releasebranch_6_4/scripts/db.out.ogr/db.out.ogr
   grass/branches/releasebranch_6_4/scripts/g.mremove/g.mremove
   grass/branches/releasebranch_6_4/scripts/i.image.mosaic/i.image.mosaic
   grass/branches/releasebranch_6_4/scripts/i.oif/i.oif
   grass/branches/releasebranch_6_4/scripts/r.mask/r.mask
   grass/branches/releasebranch_6_4/scripts/r.plane/r.plane
   grass/branches/releasebranch_6_4/scripts/v.build.all/v.build.all
   grass/branches/releasebranch_6_4/scripts/v.convert.all/v.convert.all
   grass/branches/releasebranch_6_4/scripts/v.db.reconnect.all/v.db.reconnect.all
   grass/branches/releasebranch_6_4/scripts/v.dissolve/v.dissolve
   grass/branches/releasebranch_6_4/scripts/v.in.sites.all/v.in.sites.all
   grass/branches/releasebranch_6_4/scripts/v.report/v.report
Log:
variable quoting (backport from 6.5)

Modified: grass/branches/releasebranch_6_4/scripts/db.out.ogr/db.out.ogr
===================================================================
--- grass/branches/releasebranch_6_4/scripts/db.out.ogr/db.out.ogr	2011-06-08 23:37:49 UTC (rev 46616)
+++ grass/branches/releasebranch_6_4/scripts/db.out.ogr/db.out.ogr	2011-06-08 23:39:07 UTC (rev 46617)
@@ -99,7 +99,7 @@
    fi
 fi
   
-v.out.ogr --q $GIS_OPT_INPUT dsn="$GIS_OPT_DSN" $OLAYER format=$GIS_OPT_FORMAT type=point
+v.out.ogr --q "$GIS_OPT_INPUT" dsn="$GIS_OPT_DSN" "$OLAYER" format="$GIS_OPT_FORMAT" type=point
 if [ $? -ne 0 ] ;  then
    exit 1
 fi

Modified: grass/branches/releasebranch_6_4/scripts/g.mremove/g.mremove
===================================================================
--- grass/branches/releasebranch_6_4/scripts/g.mremove/g.mremove	2011-06-08 23:37:49 UTC (rev 46616)
+++ grass/branches/releasebranch_6_4/scripts/g.mremove/g.mremove	2011-06-08 23:39:07 UTC (rev 46617)
@@ -99,7 +99,7 @@
      
 eval `g.gisenv`
 : ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
-LOCATION=$GISDBASE/$LOCATION_NAME/$MAPSET
+LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
 
 PROG=`basename "$0"`
 
@@ -111,20 +111,20 @@
    regex=""
 fi
 
-force=$GIS_FLAG_F
+force="$GIS_FLAG_F"
 
 if [ $force -eq 1 ] ; then
    g.message "Forcing ..."
 fi
 
-r=$GIS_OPT_RAST
-r3=$GIS_OPT_RAST3D
-v=$GIS_OPT_VECT
-i=$GIS_OPT_ICON
-l=$GIS_OPT_LABEL
-rg=$GIS_OPT_REGION
-g=$GIS_OPT_GROUP
-d=$GIS_OPT_DVIEW
+r="$GIS_OPT_RAST"
+r3="$GIS_OPT_RAST3D"
+v="$GIS_OPT_VECT"
+i="$GIS_OPT_ICON"
+l="$GIS_OPT_LABEL"
+rg="$GIS_OPT_REGION"
+g="$GIS_OPT_GROUP"
+d="$GIS_OPT_DVIEW"
 
 if [ -n "$r" ] ; then
     rast=`g.mlist $regex type=rast sep=, mapset=$MAPSET pattern="$r"`

Modified: grass/branches/releasebranch_6_4/scripts/i.image.mosaic/i.image.mosaic
===================================================================
--- grass/branches/releasebranch_6_4/scripts/i.image.mosaic/i.image.mosaic	2011-06-08 23:37:49 UTC (rev 46616)
+++ grass/branches/releasebranch_6_4/scripts/i.image.mosaic/i.image.mosaic	2011-06-08 23:39:07 UTC (rev 46617)
@@ -84,7 +84,7 @@
    
 eval `g.gisenv`
 : ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
-CURRLOCATION=$GISDBASE/$LOCATION_NAME/$MAPSET
+CURRLOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
 
 g.message -w message='Do not forget to set region properly to cover all images!'
 

Modified: grass/branches/releasebranch_6_4/scripts/i.oif/i.oif
===================================================================
--- grass/branches/releasebranch_6_4/scripts/i.oif/i.oif	2011-06-08 23:37:49 UTC (rev 46616)
+++ grass/branches/releasebranch_6_4/scripts/i.oif/i.oif	2011-06-08 23:39:07 UTC (rev 46617)
@@ -86,7 +86,7 @@
 
 eval `g.gisenv`
 : ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
-LOCATION=$GISDBASE/$LOCATION_NAME/$MAPSET
+LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
 
 # Open tempfiles
 temp_stddev="`g.tempfile $$`"

Modified: grass/branches/releasebranch_6_4/scripts/r.mask/r.mask
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.mask/r.mask	2011-06-08 23:37:49 UTC (rev 46616)
+++ grass/branches/releasebranch_6_4/scripts/r.mask/r.mask	2011-06-08 23:39:07 UTC (rev 46617)
@@ -68,7 +68,7 @@
 
 cleanup()
 {
- g.remove --q rast=$TEMPRAST
+ g.remove --q rast="$TEMPRAST"
 }
 
 # what to do in case of user break:

Modified: grass/branches/releasebranch_6_4/scripts/r.plane/r.plane
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.plane/r.plane	2011-06-08 23:37:49 UTC (rev 46616)
+++ grass/branches/releasebranch_6_4/scripts/r.plane/r.plane	2011-06-08 23:39:07 UTC (rev 46617)
@@ -103,30 +103,30 @@
 ### setup enviro vars ###
 eval `g.gisenv`
 : ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
-LOCATION=$GISDBASE/$LOCATION_NAME/$MAPSET
+LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
 
-dip=$GIS_OPT_DIP
-az=$GIS_OPT_AZIMUTH
-ea=$GIS_OPT_EASTING
-no=$GIS_OPT_NORTHING
-el=$GIS_OPT_ELEVATION
+dip="$GIS_OPT_DIP"
+az="$GIS_OPT_AZIMUTH"
+ea="$GIS_OPT_EASTING"
+no="$GIS_OPT_NORTHING"
+el="$GIS_OPT_ELEVATION"
 name="$GIS_OPT_NAME"
-type=$GIS_OPT_TYPE
+type="$GIS_OPT_TYPE"
 
 eval `g.region -g`
 
 
 ### test input values ###
-diptest=`echo $dip | awk '{ printf("%8d", int($1 + 0.5))'}`
-if [ $diptest -lt -90 -o $diptest -gt 90 ]
+diptest=`echo "$dip" | awk '{ printf("%8d", int($1 + 0.5))'}`
+if [ "$diptest" -lt -90 -o "$diptest" -gt 90 ]
 then
 	g.message -e "Sorry, dip must be greater than -90 and less than 90.\
 	  Please enter a valid value."
 	exit 1
 fi
 
-aztest=`echo $az | awk '{ printf("%8d", int($1 + 0.5))'}`
-if  [ $aztest -lt 0 -o $aztest -ge 360 ]
+aztest=`echo "$az" | awk '{ printf("%8d", int($1 + 0.5))'}`
+if  [ "$aztest" -lt 0 -o "$aztest" -ge 360 ]
 then
 	g.message -e "Sorry, azimuth must be no less than 0 and less than 360"
 	exit 1
@@ -154,8 +154,8 @@
 fi
 
 # these tests will fail for negative lat/lon?
-eaint=`echo $ea | awk '{ printf "%d",int($1 + 0.5) }'`
-if test $eaint -le `echo $e | cut -d. -f1` -a $eaint -ge `echo $w | cut -d. -f1`
+eaint=`echo "$ea" | awk '{ printf "%d",int($1 + 0.5) }'`
+if test "$eaint" -le `echo "$e" | cut -d. -f1` -a "$eaint" -ge `echo "$w" | cut -d. -f1`
 then
 	gotit=1
 #	echo "east: $ea"
@@ -166,8 +166,8 @@
 	exit 1
 fi
 
-noint=`echo $no | awk '{ printf "%d", int($1 + 0.5) }'`
-if test $noint -gt `echo $s | cut -d. -f1` -a $noint -lt `echo $n | cut -d. -f1`
+noint=`echo "$no" | awk '{ printf "%d", int($1 + 0.5) }'`
+if test "$noint" -gt `echo "$s" | cut -d. -f1` -a "$noint" -lt `echo "$n" | cut -d. -f1`
 then
 	gotit=1
 #	echo "north: $no"
@@ -254,8 +254,8 @@
 g.message "Running r.in.ascii, please stand by.."
 r.in.ascii `echo $typeflag` i="$TEMPFILE".2 o=$name
 
-r.support $name hist="$PROG name=$name dip=$dip azimuth=$az easting=$ea \\"
-r.support $name hist="northing=$no elevation=$el type=$type"
+r.support "$name" hist="$PROG name=$name dip=$dip azimuth=$az easting=$ea \\"
+r.support "$name" hist="northing=$no elevation=$el type=$type"
 
 g.message "Done."
 g.message message="Raster map <$name@$MAPSET> generated by r.plane \

Modified: grass/branches/releasebranch_6_4/scripts/v.build.all/v.build.all
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.build.all/v.build.all	2011-06-08 23:37:49 UTC (rev 46616)
+++ grass/branches/releasebranch_6_4/scripts/v.build.all/v.build.all	2011-06-08 23:39:07 UTC (rev 46617)
@@ -31,10 +31,10 @@
 
 eval `g.gisenv`
 : ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
-LOCATION=$GISDBASE/$LOCATION_NAME/$MAPSET
+LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
 
 
-for VECT in `g.list type=vect mapset=${MAPSET} | sed 1,2d | grep -v '^-*$'`
+for VECT in `g.list type=vect mapset="$MAPSET" | sed 1,2d | grep -v '^-*$'`
 do
     g.message "Build topology for vector '${VECT}@${MAPSET}'" 
     CMD="v.build map=${VECT}@${MAPSET}"

Modified: grass/branches/releasebranch_6_4/scripts/v.convert.all/v.convert.all
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.convert.all/v.convert.all	2011-06-08 23:37:49 UTC (rev 46616)
+++ grass/branches/releasebranch_6_4/scripts/v.convert.all/v.convert.all	2011-06-08 23:39:07 UTC (rev 46617)
@@ -36,7 +36,7 @@
 
 eval `g.gisenv`
 : ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
-LOCATION=$GISDBASE/$LOCATION_NAME/$MAPSET
+LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
 
 CONVERTEDMAPS=0
 for i in `g.mlist type=oldvect`
@@ -44,10 +44,10 @@
 
   # polish map names to be SQL compliant
   INPUT=$i
-  OUTPUT=`echo $INPUT | sed 's+\.+_+g'`
+  OUTPUT=`echo "$INPUT" | sed 's+\.+_+g'`
 
   #do it:
-  v.convert in=$INPUT out=$OUTPUT
+  v.convert in="$INPUT" out="$OUTPUT"
   if [ $? -ne 0 ] ; then
     g.message -e "Converting map $INPUT to $OUTPUT" 
   else
@@ -55,7 +55,7 @@
   fi
 done
 
-if [ $CONVERTEDMAPS -lt 1 ] ; then
+if [ "$CONVERTEDMAPS" -lt 1 ] ; then
   g.message -w "No vector maps converted as no old vector maps present in current mapset <$MAPSET>."
 else
   g.message "Total $CONVERTEDMAPS number of vector maps in current mapset converted." 

Modified: grass/branches/releasebranch_6_4/scripts/v.db.reconnect.all/v.db.reconnect.all
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.db.reconnect.all/v.db.reconnect.all	2011-06-08 23:37:49 UTC (rev 46616)
+++ grass/branches/releasebranch_6_4/scripts/v.db.reconnect.all/v.db.reconnect.all	2011-06-08 23:39:07 UTC (rev 46617)
@@ -49,16 +49,16 @@
 
 eval `g.gisenv`
 : ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
-LOCATION=$GISDBASE/$LOCATION_NAME/$MAPSET
+LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
 
 if [ "$1" != "@ARGS_PARSED@" ] ; then
    exec g.parser "$0" "$@"
 fi
 
-OLD_DATABASE=$GIS_OPT_OLD_DATABASE
-NEW_DATABASE=$GIS_OPT_NEW_DATABASE
-OLD_SCHEMA=$GIS_OPT_OLD_SCHEMA
-NEW_SCHEMA=$GIS_OPT_NEW_SCHEMA
+OLD_DATABASE="$GIS_OPT_OLD_DATABASE"
+NEW_DATABASE="$GIS_OPT_NEW_DATABASE"
+OLD_SCHEMA="$GIS_OPT_OLD_SCHEMA"
+NEW_SCHEMA="$GIS_OPT_NEW_SCHEMA"
 
 if [ -z "$OLD_DATABASE" ] ; then
   g.message -e "Old database not specified"
@@ -70,19 +70,19 @@
   exit 1
 fi
 
-for VECT in `g.list type=vect mapset=${MAPSET} | sed 1,2d | grep -v '^-*$'`
+for VECT in `g.list type=vect mapset="$MAPSET" | sed 1,2d | grep -v '^-*$'`
 do
     g.message message="Reconnecting vector '${VECT}@${MAPSET}'"
     for LINK in `v.db.connect -g fs="|" map=${VECT}@${MAPSET}` ; do
-        eval `echo $LINK | sed 's$\([^\|]*\)|\([^\|]*\)|\([^\|]*\)|\([^\|]*\)|\([^\|]*\)$LAYER=\1 SCHEMA_TABLE=\2 KEY=\3 DATABASE=\4 DRIVER=\5$'`
+        eval `echo "$LINK" | sed 's$\([^\|]*\)|\([^\|]*\)|\([^\|]*\)|\([^\|]*\)|\([^\|]*\)$LAYER=\1 SCHEMA_TABLE=\2 KEY=\3 DATABASE=\4 DRIVER=\5$'`
 
-        SCHEMA=`echo $SCHEMA_TABLE | grep '\.' | sed 's/\([^.]*\)\..*/\1/'`
-        TABLE=`echo $SCHEMA_TABLE | sed 's/.*\.//'`
+        SCHEMA=`echo "$SCHEMA_TABLE" | grep '\.' | sed 's/\([^.]*\)\..*/\1/'`
+        TABLE=`echo "$SCHEMA_TABLE" | sed 's/.*\.//'`
 
         if [ -n "$NEW_SCHEMA" ] ; then
             NEW_SCHEMA_TABLE="${NEW_SCHEMA}.${TABLE}"
         else
-            NEW_SCHEMA_TABLE="${TABLE}"
+            NEW_SCHEMA_TABLE="$TABLE"
         fi
 
         g.message message="SCHEMA = $SCHEMA TABLE = $TABLE NEW_SCHEMA_TABLE=$NEW_SCHEMA_TABLE"

Modified: grass/branches/releasebranch_6_4/scripts/v.dissolve/v.dissolve
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.dissolve/v.dissolve	2011-06-08 23:37:49 UTC (rev 46616)
+++ grass/branches/releasebranch_6_4/scripts/v.dissolve/v.dissolve	2011-06-08 23:39:07 UTC (rev 46617)
@@ -85,7 +85,7 @@
 trap "exitprocedure" 2 3 15
 
 # does map exist?
-eval `g.findfile element=vector file=$GIS_OPT_INPUT`
+eval `g.findfile element=vector file="$GIS_OPT_INPUT"`
 if [ ! "$file" ] ; then
    g.message -e "Vector map <$GIS_OPT_INPUT> not found"
    exit 1
@@ -102,7 +102,7 @@
        exit 1
     fi
 
-   table=`v.db.connect $GIS_OPT_INPUT -g fs=";" | grep -w "^$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
+   table=`v.db.connect "$GIS_OPT_INPUT" -gl fs="|" layer="$GIS_OPT_LAYER" | cut -f2 -d'|'`
    if [ -z "$table" ] ; then
       g.message -e "Database connection not defined for layer $GIS_OPT_LAYER"
       exit 1
@@ -116,7 +116,7 @@
 
 
 # write cmd history:
-v.support ${GIS_OPT_OUTPUT} cmdhist="${CMDLINE}"
+v.support "$GIS_OPT_OUTPUT" cmdhist="${CMDLINE}"
 
 exit 0
 

Modified: grass/branches/releasebranch_6_4/scripts/v.in.sites.all/v.in.sites.all
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.in.sites.all/v.in.sites.all	2011-06-08 23:37:49 UTC (rev 46616)
+++ grass/branches/releasebranch_6_4/scripts/v.in.sites.all/v.in.sites.all	2011-06-08 23:39:07 UTC (rev 46617)
@@ -34,19 +34,19 @@
 
 eval `g.gisenv`
 : ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
-LOCATION=$GISDBASE/$LOCATION_NAME/$MAPSET
+LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
 
 CONVERTEDMAPS=0
 for i in `g.mlist type=sites mapset=.`
 do
 
   # polish map names to be SQL compliant
-  INPUT=$i
-  OUTPUT=`echo $INPUT | sed 's+\.+_+g'`_points
+  INPUT="$i"
+  OUTPUT=`echo "$INPUT" | sed 's+\.+_+g'`_points
 
   #do it:
   g.message "Processing $INPUT -> $OUTPUT" 
-  v.in.sites in=$INPUT out=$OUTPUT
+  v.in.sites in="$INPUT" out="$OUTPUT"
   if [ $? -ne 0 ] ; then
     g.message -w "Error converting map $INPUT to $OUTPUT" 
   else
@@ -54,7 +54,7 @@
   fi
 done
 
-if [ $CONVERTEDMAPS -lt 1 ] ; then
+if [ "$CONVERTEDMAPS" -lt 1 ] ; then
   g.message -e "No sites maps converted as no old sites maps present in current mapset <$MAPSET>." 
 else
   g.message "Total $CONVERTEDMAPS number of sites maps in current mapset converted to vector" 

Modified: grass/branches/releasebranch_6_4/scripts/v.report/v.report
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.report/v.report	2011-06-08 23:37:49 UTC (rev 46616)
+++ grass/branches/releasebranch_6_4/scripts/v.report/v.report	2011-06-08 23:39:07 UTC (rev 46617)
@@ -72,7 +72,7 @@
 ### setup enviro vars ###
 eval `g.gisenv`
 : ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
-LOCATION=$GISDBASE/$LOCATION_NAME/$MAPSET
+LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
 
 ### trap <ctrl>-<c> so that we can clean up tmp and exit
 trap 'rm -f "$TMP1" "$TMP2" "$TMP3" "$TMP4"; exit 1' 2 3 15



More information about the grass-commit mailing list