[GRASS-SVN] r30027 - grass/trunk/scripts/v.db.renamecol

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Feb 8 18:32:34 EST 2008


Author: hamish
Date: 2008-02-08 18:32:34 -0500 (Fri, 08 Feb 2008)
New Revision: 30027

Modified:
   grass/trunk/scripts/v.db.renamecol/v.db.renamecol
Log:
'echo -n' is not portable

Modified: grass/trunk/scripts/v.db.renamecol/v.db.renamecol
===================================================================
--- grass/trunk/scripts/v.db.renamecol/v.db.renamecol	2008-02-08 21:48:24 UTC (rev 30026)
+++ grass/trunk/scripts/v.db.renamecol/v.db.renamecol	2008-02-08 23:32:34 UTC (rev 30027)
@@ -125,8 +125,10 @@
 newcol="`echo $GIS_OPT_COLUMN | cut -d',' -f2`"
 
 if [ "$driver" = "dbf" ] ; then
-  NAMELEN=`echo -n "$newcol" | wc -c | awk '{print $1}'`
-  if [ "$NAMELEN" -gt 10 ] ; then
+  NAMELEN=`echo "$newcol" | wc -c | awk '{print $1}'`
+  #max DBF column name length is 10, but wc counts echo's \n char so we test for 11.
+  #  'echo -n' (output as string, ie with no newline) is apparently not portable.
+  if [ "$NAMELEN" -gt 11 ] ; then
    g.message -e "Column name too long <$newcol>: the DBF driver only supports up to 10 characters as column name."
    cleanup
    exit 1



More information about the grass-commit mailing list