[GRASS-SVN] r40686 - in grass/branches/develbranch_6/scripts: d.polar db.dropcol i.fusion.brovey m.proj

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 26 23:15:08 EST 2010


Author: hamish
Date: 2010-01-26 23:15:08 -0500 (Tue, 26 Jan 2010)
New Revision: 40686

Modified:
   grass/branches/develbranch_6/scripts/d.polar/d.polar
   grass/branches/develbranch_6/scripts/db.dropcol/db.dropcol
   grass/branches/develbranch_6/scripts/i.fusion.brovey/i.fusion.brovey
   grass/branches/develbranch_6/scripts/m.proj/m.proj
Log:
rename TMP cariable to avoid namespace collision on MS Windows (trac #890)

Modified: grass/branches/develbranch_6/scripts/d.polar/d.polar
===================================================================
--- grass/branches/develbranch_6/scripts/d.polar/d.polar	2010-01-27 04:03:12 UTC (rev 40685)
+++ grass/branches/develbranch_6/scripts/d.polar/d.polar	2010-01-27 04:15:08 UTC (rev 40686)
@@ -86,12 +86,12 @@
 export LC_NUMERIC
 
 
-TMP="`g.tempfile pid=$$`"
-if [ $? -ne 0 ] || [ -z "${TMP}" ] ; then
+TEMPFILE="`g.tempfile pid=$$`"
+if [ $? -ne 0 ] || [ -z "$TEMPFILE" ] ; then
     g.message -e "unable to create temporary files"
     exit 1
 fi
-#TMP=`dirname $TMP`
+#TEMPFILE=`dirname $TEMPFILE`
 
 wordcount()
 {
@@ -111,28 +111,28 @@
 
 cleanup()
 {
-   \rm -f "${TMP}" "${TMP}_"*
+   \rm -f "$TEMPFILE" "${TEMPFILE}_"*
 }
 
 #################################
 # this file contains everthing:
-r.stats -1 "$GIS_OPT_MAP" > "${TMP}_raw"
-TOTALNUMBER=`wc -l "${TMP}_raw" | awk '{print $1}'`
+r.stats -1 "$GIS_OPT_MAP" > "${TEMPFILE}_raw"
+TOTALNUMBER=`wc -l "${TEMPFILE}_raw" | awk '{print $1}'`
 
 g.message "Calculating statistics for polar diagram... (be patient)"
 
 #wipe out NULL data and undef data if defined by user
 # - generate degree binned to integer, eliminate NO DATA (NULL):
 # change 360 to 0 to close polar diagram:
-cat "${TMP}_raw" | grep -v '^\*$' | grep -v "^${GIS_OPT_UNDEF}$" | \
-    awk '{printf "%d\n", int($1 + .5)}' | sed 's+^360+0+g'  > "${TMP}_binned"
+cat "${TEMPFILE}_raw" | grep -v '^\*$' | grep -v "^${GIS_OPT_UNDEF}$" | \
+    awk '{printf "%d\n", int($1 + .5)}' | sed 's+^360+0+g'  > "${TEMPFILE}_binned"
 
 # make radians
-cat "${TMP}_binned" | awk '{printf "%f\n", (3.14159265 * $1 ) / 180.}'  > "${TMP}_binned_radians"
+cat "${TEMPFILE}_binned" | awk '{printf "%f\n", (3.14159265 * $1 ) / 180.}'  > "${TEMPFILE}_binned_radians"
 
 #################################
 # generate numbers for max circle
-TOTALVALIDNUMBER=`wc -l "${TMP}_binned_radians" | awk '{print $1}'`
+TOTALVALIDNUMBER=`wc -l "${TEMPFILE}_binned_radians" | awk '{print $1}'`
 
 if [ "$TOTALVALIDNUMBER" -eq 0 ] ; then
    g.message -e "No data pixel found"
@@ -142,41 +142,41 @@
 
 #################################
 # unit vector on raw data converted to radians without no data:
-cat "${TMP}_raw" | grep -v '^\*' | grep -v "^${GIS_OPT_UNDEF}$" | awk 'BEGIN {sum = 0.0}
+cat "${TEMPFILE}_raw" | grep -v '^\*' | grep -v "^${GIS_OPT_UNDEF}$" | awk 'BEGIN {sum = 0.0}
 NR == 1{}
        {sum += cos(3.14159265 * $1 / 180.)}
-END{print sum}' > "${TMP}_cos_sums"
+END{print sum}' > "${TEMPFILE}_cos_sums"
 
-cat "${TMP}_raw" | grep -v '^\*' | grep -v "^${GIS_OPT_UNDEF}$" | awk 'BEGIN {sum = 0.0}
+cat "${TEMPFILE}_raw" | grep -v '^\*' | grep -v "^${GIS_OPT_UNDEF}$" | awk 'BEGIN {sum = 0.0}
 NR == 1{}
        {sum += sin(3.14159265 * $1 / 180.)}
-END{print sum}' > "${TMP}_sin_sums"
+END{print sum}' > "${TEMPFILE}_sin_sums"
 
 # cos -> x, sin -> y
-echo "`cat "${TMP}_cos_sums"` $TOTALVALIDNUMBER" | awk '{printf "%.8f\n", $1/$2}' > "${TMP}_x_unit_vector"
-echo "`cat "${TMP}_sin_sums"` $TOTALVALIDNUMBER" | awk '{printf "%.8f\n", $1/$2}' > "${TMP}_y_unit_vector"
-UNITVECTOR=`paste -d' ' "${TMP}_x_unit_vector" "${TMP}_y_unit_vector"`
+echo "`cat "${TEMPFILE}_cos_sums"` $TOTALVALIDNUMBER" | awk '{printf "%.8f\n", $1/$2}' > "${TEMPFILE}_x_unit_vector"
+echo "`cat "${TEMPFILE}_sin_sums"` $TOTALVALIDNUMBER" | awk '{printf "%.8f\n", $1/$2}' > "${TEMPFILE}_y_unit_vector"
+UNITVECTOR=`paste -d' ' "${TEMPFILE}_x_unit_vector" "${TEMPFILE}_y_unit_vector"`
 
 #################################
 # how many are there?:
-wordcount "${TMP}_binned_radians" | sort -n -t ' ' -k 1 > "${TMP}_occurrences"
+wordcount "${TEMPFILE}_binned_radians" | sort -n -t ' ' -k 1 > "${TEMPFILE}_occurrences"
 
 # find the maximum value
-MAXRADIUS="`cat "${TMP}_occurrences" | sort -n -t ' ' -k 2 | tail -n 1 | cut -d' ' -f2`"
+MAXRADIUS="`cat "${TEMPFILE}_occurrences" | sort -n -t ' ' -k 2 | tail -n 1 | cut -d' ' -f2`"
 
 # now do cos() sin()
-cat "${TMP}_occurrences" | awk '{printf "%f %f\n", cos($1) * $2 , sin($1) *$2}' > "${TMP}_sine_cosine"
+cat "${TEMPFILE}_occurrences" | awk '{printf "%f %f\n", cos($1) * $2 , sin($1) *$2}' > "${TEMPFILE}_sine_cosine"
 
 # to close the curve, we replicate the first value
-REPLICATE=`head -n 1 "${TMP}_sine_cosine"`
-echo "\"Real data angles"           >  "${TMP}_sine_cosine_replic"
-cat "${TMP}_sine_cosine" >> "${TMP}_sine_cosine_replic"
-echo $REPLICATE >> "${TMP}_sine_cosine_replic"
+REPLICATE=`head -n 1 "${TEMPFILE}_sine_cosine"`
+echo "\"Real data angles"           >  "${TEMPFILE}_sine_cosine_replic"
+cat "${TEMPFILE}_sine_cosine" >> "${TEMPFILE}_sine_cosine_replic"
+echo $REPLICATE >> "${TEMPFILE}_sine_cosine_replic"
 
 PI=3.14159265358979323846
 if [ -n "$GIS_OPT_EPS" ] || [ $GIS_FLAG_X -eq 1 ] ; then
-  rm -f "${TMP}_outercircle"
-    echo "\"All Data incl. NULLs"           > "${TMP}_outercircle"
+  rm -f "${TEMPFILE}_outercircle"
+    echo "\"All Data incl. NULLs"           > "${TEMPFILE}_outercircle"
 
   awk -v PI=$PI -v TOTAL=$TOTALNUMBER -v TOTALVALID=$TOTALVALIDNUMBER \
       -v MAXRADIUS=$MAXRADIUS 'BEGIN {
@@ -185,16 +185,16 @@
 	      cos(i * PI/180) * TOTAL/TOTALVALID * MAXRADIUS,
 	      sin(i * PI/180) * TOTAL/TOTALVALID * MAXRADIUS)
 	}
-   }' >> "${TMP}_outercircle"
+   }' >> "${TEMPFILE}_outercircle"
 fi
 
 
 # fix vector length to become visible (x? of $MAXRADIUS):
 AUTOSTRETCH="1"
-echo "\"Avg. Direction" > "${TMP}_vector"
-echo "0 0"         >> "${TMP}_vector"
+echo "\"Avg. Direction" > "${TEMPFILE}_vector"
+echo "0 0"         >> "${TEMPFILE}_vector"
 echo "$UNITVECTOR $MAXRADIUS $AUTOSTRETCH" | \
-    awk '{printf "%f %f\n", $1 * $3, $2 * $3}' >> "${TMP}_vector"
+    awk '{printf "%f %f\n", $1 * $3, $2 * $3}' >> "${TEMPFILE}_vector"
 
 
 ###########################################################
@@ -203,9 +203,9 @@
 plot_xgraph()
 {
 # by M.Neteler
-echo "" > "${TMP}_newline"
-cat "${TMP}_sine_cosine_replic" "${TMP}_newline" "${TMP}_outercircle" \
-      "${TMP}_newline" "${TMP}_vector" | xgraph
+echo "" > "${TEMPFILE}_newline"
+cat "${TEMPFILE}_sine_cosine_replic" "${TEMPFILE}_newline" "${TEMPFILE}_outercircle" \
+      "${TEMPFILE}_newline" "${TEMPFILE}_vector" | xgraph
 }
 
 
@@ -262,9 +262,9 @@
 SCALEVAL=`awk -v RING=$RING -v TOTAL=$TOTALNUMBER -v TOTALVALID=$TOTALVALIDNUMBER \
     'BEGIN { print RING * TOTALVALID/TOTAL }'`
 
-cat "${TMP}_sine_cosine_replic" | tail -n +2 | awk -v SCL=$SCALEVAL -v MAX=$MAXRADIUS \
+cat "${TEMPFILE}_sine_cosine_replic" | tail -n +2 | awk -v SCL=$SCALEVAL -v MAX=$MAXRADIUS \
     '{printf "%f %f\n", ((SCL * $1/MAX) +1)*50, ((SCL * $2/MAX) +1)*50}' \
-       > "${TMP}_sine_cosine_replic_normalized"
+       > "${TEMPFILE}_sine_cosine_replic_normalized"
 
 # create circle
 awk -v RING=$RING -v PI=$PI 'BEGIN {
@@ -272,16 +272,16 @@
      printf("%f %f\n", 50*(1+(RING * sin(i * (PI/180)))),
 	    50*(1+(RING * cos(i * (PI/180)))) )
    }
- }' > "${TMP}_circle"
+ }' > "${TEMPFILE}_circle"
 
 # trend vector
-VECT=`cat "${TMP}_vector" | tail -n 1 | awk -v SCL=$SCALEVAL -v MAX=$MAXRADIUS \
+VECT=`cat "${TEMPFILE}_vector" | tail -n 1 | awk -v SCL=$SCALEVAL -v MAX=$MAXRADIUS \
     '{printf "%f %f\n", ((SCL * $1/MAX)+1)*50, ((SCL * $2/MAX)+1)*50}'`
 
 
 # Possible TODOs:
 # To have d.polar survive d.redraw, write d.graph commands to a
-#  ${TMP}.dpolar.dgraph file and then use d.graph input=${TMP}.dpolar.dgraph.
+#  ${TEMPFILE}.dpolar.dgraph file and then use d.graph input=${TEMPFILE}.dpolar.dgraph.
 #  The file will be cleaned up when the grass session exits.
 #
 # To fill data area with color, use BOTH d.graph's polyline and polygon commands.
@@ -296,7 +296,7 @@
   #   mandatory when drawing proportional to non-square frame
   color 180:255:180
   polyline
-    `cat "${TMP}_circle"`
+    `cat "${TEMPFILE}_circle"`
 
   # draw axes
   color 180:180:180
@@ -310,7 +310,7 @@
   color red
   width 0
   polyline
-   `cat "${TMP}_sine_cosine_replic_normalized"`
+   `cat "${TEMPFILE}_sine_cosine_replic_normalized"`
 
   # draw vector
   color blue
@@ -436,14 +436,14 @@
                                         %% first point moveto, then lineto
 " >> "$PSOUT"
 
-SUBLENGTH=`wc -l "${TMP}_outercircle" | awk '{printf "%d", $1 - 2}'`
-LINE1=`head -n 2 "${TMP}_outercircle" | tail -n 1`
+SUBLENGTH=`wc -l "${TEMPFILE}_outercircle" | awk '{printf "%d", $1 - 2}'`
+LINE1=`head -n 2 "${TEMPFILE}_outercircle" | tail -n 1`
 echo $LINE1 $SCALE $HALFFRAME | awk '{printf "%.2f %.2f moveto\n", $1*$3+$4, $2*$3+$4}' >> "$PSOUT"
 
-tail -n $SUBLENGTH "${TMP}_outercircle" | sed "s+\$+ $SCALE $HALFFRAME+g" > "${TMP}_outercircle_lineto"
+tail -n $SUBLENGTH "${TEMPFILE}_outercircle" | sed "s+\$+ $SCALE $HALFFRAME+g" > "${TEMPFILE}_outercircle_lineto"
 
-cat "${TMP}_outercircle_lineto" | awk '{printf "%.2f %.2f lineto\n",$1*$3+$4, $2*$3+$4 }' >> "$PSOUT"
-rm -f "${TMP}_outercircle_lineto"
+cat "${TEMPFILE}_outercircle_lineto" | awk '{printf "%.2f %.2f lineto\n",$1*$3+$4, $2*$3+$4 }' >> "$PSOUT"
+rm -f "${TEMPFILE}_outercircle_lineto"
 
 echo "stroke
 
@@ -472,17 +472,17 @@
                                         %% first point moveto, then lineto
 " >> "$PSOUT"
 
-SUBLENGTH=`wc -l "${TMP}_sine_cosine_replic" | awk '{printf "%d", $1 - 2}'`
-LINE1=`head -n 2 "${TMP}_sine_cosine_replic" | tail -n 1`
+SUBLENGTH=`wc -l "${TEMPFILE}_sine_cosine_replic" | awk '{printf "%d", $1 - 2}'`
+LINE1=`head -n 2 "${TEMPFILE}_sine_cosine_replic" | tail -n 1`
 echo $LINE1 $SCALE $HALFFRAME | awk '{printf "%.2f %.2f moveto\n", $1*$3+$4, $2*$3+$4}' >> "$PSOUT"
 
-tail -n $SUBLENGTH "${TMP}_sine_cosine_replic" | \
-   sed "s+\$+ $SCALE $HALFFRAME+g" > "${TMP}_sine_cosine_replic_lineto"
+tail -n $SUBLENGTH "${TEMPFILE}_sine_cosine_replic" | \
+   sed "s+\$+ $SCALE $HALFFRAME+g" > "${TEMPFILE}_sine_cosine_replic_lineto"
 
-cat "${TMP}_sine_cosine_replic_lineto" | \
+cat "${TEMPFILE}_sine_cosine_replic_lineto" | \
    awk '{printf "%.2f %.2f lineto\n",$1*$3+$4, $2*$3+$4 }' >> "$PSOUT"
 
-rm -f "${TMP}_sine_cosine_replic_lineto"
+rm -f "${TEMPFILE}_sine_cosine_replic_lineto"
 
 echo "stroke
 %%
@@ -497,14 +497,14 @@
                                         %% first point moveto, second lineto
 " >> $PSOUT
 
-SUBLENGTH=`wc -l "${TMP}_vector" | awk '{printf "%d", $1 - 2}'`
-LINE1=`head -n 2 "${TMP}_vector" | tail -n 1`
+SUBLENGTH=`wc -l "${TEMPFILE}_vector" | awk '{printf "%d", $1 - 2}'`
+LINE1=`head -n 2 "${TEMPFILE}_vector" | tail -n 1`
 echo $LINE1 $SCALE $HALFFRAME | awk '{printf "%.2f %.2f moveto\n", $1*$3+$4, $2*$3+$4}' >> "$PSOUT"
 
-tail -n $SUBLENGTH "${TMP}_vector" | sed "s+\$+ $SCALE $HALFFRAME+g" > "${TMP}_vector_lineto"
+tail -n $SUBLENGTH "${TEMPFILE}_vector" | sed "s+\$+ $SCALE $HALFFRAME+g" > "${TEMPFILE}_vector_lineto"
 
-cat "${TMP}_vector_lineto" | awk '{printf "%.2f %.2f lineto\n",$1*$3+$4, $2*$3+$4 }' >> "$PSOUT"
-rm -f "${TMP}_vector_lineto"
+cat "${TEMPFILE}_vector_lineto" | awk '{printf "%.2f %.2f lineto\n",$1*$3+$4, $2*$3+$4 }' >> "$PSOUT"
+rm -f "${TEMPFILE}_vector_lineto"
 
 echo "stroke
 

Modified: grass/branches/develbranch_6/scripts/db.dropcol/db.dropcol
===================================================================
--- grass/branches/develbranch_6/scripts/db.dropcol/db.dropcol	2010-01-27 04:03:12 UTC (rev 40685)
+++ grass/branches/develbranch_6/scripts/db.dropcol/db.dropcol	2010-01-27 04:15:08 UTC (rev 40686)
@@ -67,15 +67,15 @@
 export LC_NUMERIC
 
 #### setup temporary file
-TMP="`g.tempfile pid=$$`"
-if [ $? -ne 0 ] || [ -z "$TMP" ] ; then
+TEMPFILE="`g.tempfile pid=$$`"
+if [ $? -ne 0 ] || [ -z "$TEMPFILE" ] ; then
     g.message -e "Unable to create temporary files" 
     exit 1
 fi
 
 cleanup()
 {
- \rm -f "$TMP" "$TMP.coltypes" "$TMP.colnames" "$TMP.coldesc"
+ \rm -f "$TEMPFILE" "$TEMPFILE.coltypes" "$TEMPFILE.colnames" "$TEMPFILE.coldesc"
 }
 
 # what to do in case of user break:
@@ -133,11 +133,11 @@
 if [ "$driver" = "sqlite" ] ; then
 	#echo "Using special trick for SQLite"
 	# http://www.sqlite.org/faq.html#q13
-	db.describe -c $table | grep '^Column ' | cut -d':' -f2,3 | grep -v "${col}:" > "$TMP.coldesc"
-	cat "$TMP.coldesc" | cut -d':' -f2 > "$TMP.coltypes"
-	cat "$TMP.coldesc" | cut -d':' -f1 > "$TMP.colnames"
-	COLDEF=`paste -d' ' "$TMP.colnames" "$TMP.coltypes" | tr '\n' ',' | sed 's+,$++g'`
-	COLNAMES=`cat "$TMP.colnames" | tr '\n' ',' | sed 's+,$++g'`
+	db.describe -c $table | grep '^Column ' | cut -d':' -f2,3 | grep -v "${col}:" > "$TEMPFILE.coldesc"
+	cat "$TEMPFILE.coldesc" | cut -d':' -f2 > "$TEMPFILE.coltypes"
+	cat "$TEMPFILE.coldesc" | cut -d':' -f1 > "$TEMPFILE.colnames"
+	COLDEF=`paste -d' ' "$TEMPFILE.colnames" "$TEMPFILE.coltypes" | tr '\n' ',' | sed 's+,$++g'`
+	COLNAMES=`cat "$TEMPFILE.colnames" | tr '\n' ',' | sed 's+,$++g'`
 echo "BEGIN TRANSACTION;
 CREATE TEMPORARY TABLE ${table}_backup(${COLDEF});
 INSERT INTO ${table}_backup SELECT ${COLNAMES} FROM ${table};
@@ -145,8 +145,8 @@
 CREATE TABLE ${table}(${COLDEF});
 INSERT INTO ${table} SELECT ${COLNAMES} FROM ${table}_backup;
 DROP TABLE ${table}_backup;
-COMMIT;" > "$TMP"
-	db.execute input="$TMP"
+COMMIT;" > "$TEMPFILE"
+	db.execute input="$TEMPFILE"
 	if [ $? -eq 1 ] ; then
 	    	g.message -e "Cannot continue (problem deleting column)."
 	    	cleanup

Modified: grass/branches/develbranch_6/scripts/i.fusion.brovey/i.fusion.brovey
===================================================================
--- grass/branches/develbranch_6/scripts/i.fusion.brovey/i.fusion.brovey	2010-01-27 04:03:12 UTC (rev 40685)
+++ grass/branches/develbranch_6/scripts/i.fusion.brovey/i.fusion.brovey	2010-01-27 04:15:08 UTC (rev 40686)
@@ -102,7 +102,7 @@
 {
    #remove temporary region file
    unset WIND_OVERRIDE
-   g.remove region="i.fusion.brovey.$TMP" --quiet
+   g.remove region="i.fusion.brovey.$TMPPID" --quiet
 }
 
 # what to do in case of user break:
@@ -129,7 +129,7 @@
 LC_NUMERIC=C
 export LC_NUMERIC
 
-TMP=$$
+TMPPID=$$
 
 if [ $GIS_FLAG_S -eq 0 -a $GIS_FLAG_L -eq 0 -a $GIS_FLAG_Q -eq 0 ] ; then
    g.message -e "Please select a flag to specify the satellite sensor"
@@ -144,10 +144,10 @@
 fi
 
 # clone current region
-g.region save="i.fusion.brovey.$TMP"
+g.region save="i.fusion.brovey.$TMPPID"
 
 g.message -v message="Using resolution from PAN: $PANRES"
-WIND_OVERRIDE="i.fusion.brovey.$TMP"
+WIND_OVERRIDE="i.fusion.brovey.$TMPPID"
 export WIND_OVERRIDE
 g.region res="$PANRES" -a
 
@@ -209,9 +209,9 @@
    r.colors "$GIS_OPT_OUTPUTPREFIX.green" col=aspect
    r.colors "$GIS_OPT_OUTPUTPREFIX.red" col=aspect
    g.message "Fixing output names..."
-   g.rename "$GIS_OPT_OUTPUTPREFIX.green","$GIS_OPT_OUTPUTPREFIX.$TMP" --quiet
+   g.rename "$GIS_OPT_OUTPUTPREFIX.green","$GIS_OPT_OUTPUTPREFIX.$TMPPID" --quiet
    g.rename "$GIS_OPT_OUTPUTPREFIX.red","$GIS_OPT_OUTPUTPREFIX.green" --quiet
-   g.rename "$GIS_OPT_OUTPUTPREFIX.$TMP","$GIS_OPT_OUTPUTPREFIX.red" --quiet
+   g.rename "$GIS_OPT_OUTPUTPREFIX.$TMPPID","$GIS_OPT_OUTPUTPREFIX.red" --quiet
 else
    #aspect table is nice for LANDSAT and QuickBird:
    g.message message="Assigning color tables for LANDSAT or QuickBird... (step 4/4)"

Modified: grass/branches/develbranch_6/scripts/m.proj/m.proj
===================================================================
--- grass/branches/develbranch_6/scripts/m.proj/m.proj	2010-01-27 04:03:12 UTC (rev 40685)
+++ grass/branches/develbranch_6/scripts/m.proj/m.proj	2010-01-27 04:15:08 UTC (rev 40686)
@@ -164,7 +164,7 @@
 fi
 if [ -z "$IN_PROJ" ] ; then
    g.message -e "Missing input projection parameters."
-   rm -f "$TMP"
+   rm -f "$TEMPFILE"
    exit 1
 fi
 
@@ -188,8 +188,8 @@
 g.message message="output parameters=[$OUT_PROJ]"
 
 #### setup temporary file
-TMP="`g.tempfile pid=$$`"
-if [ $? -ne 0 ] || [ -z "$TMP" ] ; then
+TEMPFILE="`g.tempfile pid=$$`"
+if [ $? -ne 0 ] || [ -z "$TEMPFILE" ] ; then
    g.message -e "Unable to create temporary file" 
    exit 1
 fi
@@ -203,16 +203,16 @@
       read REPLY
       EXITCODE=$?
       if [ -n "$REPLY" ] ; then
-	 echo "$REPLY" >> "$TMP"
+	 echo "$REPLY" >> "$TEMPFILE"
       fi
    done
 
    # make sure we have at least one line of data
-   if [ "`wc -l "$TMP" | cut -f1 -d' '`" -eq 0 ] ; then
+   if [ "`wc -l "$TEMPFILE" | cut -f1 -d' '`" -eq 0 ] ; then
       g.message -e "Problem reading data from stdin"
       exit 1
    fi
-   infile="$TMP"
+   infile="$TEMPFILE"
 else
    infile="$GIS_OPT_INPUT"
 fi
@@ -287,8 +287,8 @@
 fi
 
 #### cleanup
-if [ -e "$TMP" ] ; then
-   rm -f "$TMP"
+if [ -e "$TEMPFILE" ] ; then
+   rm -f "$TEMPFILE"
 fi
 
 exit 0



More information about the grass-commit mailing list