[GRASS-SVN] r55065 - grass-addons/grass6/vector/v.in.ply
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Feb 14 15:47:53 PST 2013
Author: hamish
Date: 2013-02-14 15:47:53 -0800 (Thu, 14 Feb 2013)
New Revision: 55065
Modified:
grass-addons/grass6/vector/v.in.ply/v.in.ply
Log:
a == b is a bashism, curly brackets do not protect variables, use "quotes" instead
Modified: grass-addons/grass6/vector/v.in.ply/v.in.ply
===================================================================
--- grass-addons/grass6/vector/v.in.ply/v.in.ply 2013-02-14 20:30:09 UTC (rev 55064)
+++ grass-addons/grass6/vector/v.in.ply/v.in.ply 2013-02-14 23:47:53 UTC (rev 55065)
@@ -40,7 +40,7 @@
if [ -z "$GISBASE" ] ; then
echo "You must be in GRASS GIS to run this program." >&2
- exit 1
+ exit 1
fi
# save command line
@@ -66,11 +66,11 @@
LC_NUMERIC=C
export LC_NUMERIC
-cat ${GIS_OPT_FILE} | awk "/ply/,/end_header/" > /dev/null
-DATALINES=`head -n 30 ${GIS_OPT_FILE} | grep 'element vertex' | cut -d' ' -f3`
+cat "$GIS_OPT_FILE" | awk "/ply/,/end_header/" > /dev/null
+DATALINES=`head -n 30 "$GIS_OPT_FILE" | grep 'element vertex' | cut -d' ' -f3`
-head -n 30 ${GIS_OPT_FILE} | grep 'char red' > /dev/null 2>/dev/null
-if [ $? == 0 ] ; then
+head -n 30 "$GIS_OPT_FILE" | grep 'char red' > /dev/null 2>/dev/null
+if [ $? -eq 0 ] ; then
echo "Colors found in PLY file, creating GRASSRGB column"
COLOR=1
else
@@ -83,14 +83,22 @@
MAP=`basename $GIS_OPT_FILE .ply`
fi
-if [ $COLOR == 0 ] ; then
- tail -n $DATALINES ${GIS_OPT_FILE} | tr -s ' ' ' ' | sed 's+^ ++g' | cut -d' ' -f1-3 | v.in.ascii -z x=1 y=2 z=3 out=$MAP fs=" "
+if [ "$COLOR" -eq 0 ] ; then
+ tail -n $DATALINES "$GIS_OPT_FILE" | tr -s ' ' ' ' | \
+ sed 's+^ ++g' | cut -d' ' -f1-3 | \
+ v.in.ascii -z x=1 y=2 z=3 out=$MAP fs=" "
+
if [ $? -ne 0 ] ; then
g.message -e "An error occurred. Halting."
exit 1
fi
else
- tail -n $DATALINES ${GIS_OPT_FILE} | tr -s ' ' ' ' | sed 's+^ ++g' | cut -d' ' -f1-7 | awk -F " " '{printf "%f,%f,%f,%d:%d:%d,%d\n", $1, $2, $3, $4, $5, $6, $7}' | v.in.ascii -z x=1 y=2 z=3 out=$MAP fs="," columns="x double precision,y double precision,z double precision,GRASSRGB varchar(11),alpha integer"
+ tail -n $DATALINES "$GIS_OPT_FILE" | tr -s ' ' ' ' | \
+ sed 's+^ ++g' | cut -d' ' -f1-7 | \
+ awk -F " " '{printf "%f,%f,%f,%d:%d:%d,%d\n", $1, $2, $3, $4, $5, $6, $7}' | \
+ v.in.ascii -z x=1 y=2 z=3 out=$MAP fs="," \
+ columns="x double precision,y double precision,z double precision,GRASSRGB varchar(11),alpha integer"
+
if [ $? -ne 0 ] ; then
g.message -e "An error occurred. Halting."
exit 1
@@ -98,6 +106,6 @@
fi
# write cmd history:
-v.support "$MAP" cmdhist="${CMDLINE}"
+v.support "$MAP" cmdhist="$CMDLINE"
exit 0
More information about the grass-commit
mailing list