[GRASS-SVN] r40269 - in grass/branches/releasebranch_6_4/scripts: db.droptable v.db.droptable

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 5 19:04:34 EST 2010


Author: hamish
Date: 2010-01-05 19:04:34 -0500 (Tue, 05 Jan 2010)
New Revision: 40269

Modified:
   grass/branches/releasebranch_6_4/scripts/db.droptable/db.droptable
   grass/branches/releasebranch_6_4/scripts/v.db.droptable/v.db.droptable
Log:
quoting and other fixes for wingrass (hopefully fixes #809)

Modified: grass/branches/releasebranch_6_4/scripts/db.droptable/db.droptable
===================================================================
--- grass/branches/releasebranch_6_4/scripts/db.droptable/db.droptable	2010-01-06 00:00:12 UTC (rev 40268)
+++ grass/branches/releasebranch_6_4/scripts/db.droptable/db.droptable	2010-01-06 00:04:34 UTC (rev 40269)
@@ -85,11 +85,11 @@
 fi
 
 # check if table is used somewhere (connected to vector map)
-USEDINMAPS="`grep $table ${GISDBASE}/${LOCATION_NAME}/*/vector/*/dbln | cut -d':' -f1 | sed 's+/dbln++g'`"
-if  [ ! -z "$USEDINMAPS" ] ; then
+USEDINMAPS=`grep "$table" "$GISDBASE/$LOCATION_NAME"/*/vector/*/dbln | sed -e 's+/dbln:.*$++g' -e 's+^.*/++'`
+if  [ -n "$USEDINMAPS" ] ; then
    g.message -w "Deleting <$table> table which is attached to following map(s):"
    for i in $USEDINMAPS ; do
-       echo "`basename $i`"
+       echo "`basename "$i"`"
    done
 fi
 
@@ -101,10 +101,10 @@
 fi
 
 
-echo "DROP TABLE $table" | db.execute database="${database}" driver=${driver}
-if [ $? -eq 1 ] ; then
-  	g.message -e "Cannot continue (problem deleting column)."
-    	exit 1
+echo "DROP TABLE $table" | db.execute database="$database" driver="$driver"
+if [ $? -ne 0 ] ; then
+    g.message -e "Cannot continue (problem deleting column)."
+    exit 1
 fi
 
-exit 0
+exit

Modified: grass/branches/releasebranch_6_4/scripts/v.db.droptable/v.db.droptable
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.db.droptable/v.db.droptable	2010-01-06 00:00:12 UTC (rev 40268)
+++ grass/branches/releasebranch_6_4/scripts/v.db.droptable/v.db.droptable	2010-01-06 00:04:34 UTC (rev 40269)
@@ -79,7 +79,7 @@
        exit 1
     fi
     table=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
-    if [ -z $table ] ; then
+    if [ -z "$table" ] ; then
        g.message -e "No table assigned to layer <$GIS_OPT_LAYER>"
        exit 1
     fi
@@ -87,7 +87,7 @@
 else
     # Removing user specified table
     existingtable=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
-    table=$GIS_OPT_TABLE
+    table="$GIS_OPT_TABLE"
     if [ "$existingtable" != "$table" ] ; then
        g.message -e "User selected table <$table> but the table <$existingtable> is linked to layer <$GIS_OPT_LAYER>" 
        exit 1
@@ -105,7 +105,7 @@
 
 g.message "Removing table <$table> linked to layer <$GIS_OPT_LAYER> of vector map <$GIS_OPT_MAP>" 
 
-if [ $GIS_FLAG_f -eq 0 ] ; then
+if [ $GIS_FLAG_F -eq 0 ] ; then
    g.message "You must use the force flag to actually remove the table. Exiting."
    exit 0
 else



More information about the grass-commit mailing list