[GRASS-SVN] r40266 - grass/branches/develbranch_6/scripts/db.droptable

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 5 18:49:35 EST 2010


Author: hamish
Date: 2010-01-05 18:49:33 -0500 (Tue, 05 Jan 2010)
New Revision: 40266

Modified:
   grass/branches/develbranch_6/scripts/db.droptable/db.droptable
Log:
fixes for windows, quoting and deal with C: for grep's C:filename:found regex

Modified: grass/branches/develbranch_6/scripts/db.droptable/db.droptable
===================================================================
--- grass/branches/develbranch_6/scripts/db.droptable/db.droptable	2010-01-05 23:20:45 UTC (rev 40265)
+++ grass/branches/develbranch_6/scripts/db.droptable/db.droptable	2010-01-05 23:49:33 UTC (rev 40266)
@@ -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



More information about the grass-commit mailing list