[GRASS-SVN] r41340 - in grass/branches/releasebranch_6_4/scripts: d.polar db.dropcol i.fusion.brovey m.proj r.in.wms r.mask r.plane r.regression.line r.univar.sh v.colors v.db.dropcol v.db.renamecol v.db.univar v.dissolve v.in.garmin v.in.gpsbabel v.in.mapgen v.in.wfs v.out.gpsbabel v.rast.stats v.univar.sh

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Mar 7 17:07:49 EST 2010


Author: neteler
Date: 2010-03-07 17:07:48 -0500 (Sun, 07 Mar 2010)
New Revision: 41340

Modified:
   grass/branches/releasebranch_6_4/scripts/d.polar/d.polar
   grass/branches/releasebranch_6_4/scripts/db.dropcol/db.dropcol
   grass/branches/releasebranch_6_4/scripts/i.fusion.brovey/i.fusion.brovey
   grass/branches/releasebranch_6_4/scripts/m.proj/m.proj
   grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.gdalwarp
   grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.wms
   grass/branches/releasebranch_6_4/scripts/r.in.wms/wms.download
   grass/branches/releasebranch_6_4/scripts/r.mask/r.mask
   grass/branches/releasebranch_6_4/scripts/r.plane/r.plane
   grass/branches/releasebranch_6_4/scripts/r.regression.line/r.regression.line
   grass/branches/releasebranch_6_4/scripts/r.univar.sh/r.univar.sh
   grass/branches/releasebranch_6_4/scripts/v.colors/v.colors
   grass/branches/releasebranch_6_4/scripts/v.db.dropcol/v.db.dropcol
   grass/branches/releasebranch_6_4/scripts/v.db.renamecol/v.db.renamecol
   grass/branches/releasebranch_6_4/scripts/v.db.univar/v.db.univar
   grass/branches/releasebranch_6_4/scripts/v.dissolve/v.dissolve
   grass/branches/releasebranch_6_4/scripts/v.in.garmin/v.in.garmin
   grass/branches/releasebranch_6_4/scripts/v.in.gpsbabel/v.in.gpsbabel
   grass/branches/releasebranch_6_4/scripts/v.in.mapgen/v.in.mapgen
   grass/branches/releasebranch_6_4/scripts/v.in.wfs/v.in.wfs
   grass/branches/releasebranch_6_4/scripts/v.out.gpsbabel/v.out.gpsbabel
   grass/branches/releasebranch_6_4/scripts/v.rast.stats/v.rast.stats
   grass/branches/releasebranch_6_4/scripts/v.univar.sh/v.univar.sh
Log:
combined backport of renaming TMP variable to avoid namespace collision on MS Windows (r40686, r40687, r40689, r40690, r41338; trac #890)

Modified: grass/branches/releasebranch_6_4/scripts/d.polar/d.polar
===================================================================
--- grass/branches/releasebranch_6_4/scripts/d.polar/d.polar	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/d.polar/d.polar	2010-03-07 22:07:48 UTC (rev 41340)
@@ -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/releasebranch_6_4/scripts/db.dropcol/db.dropcol
===================================================================
--- grass/branches/releasebranch_6_4/scripts/db.dropcol/db.dropcol	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/db.dropcol/db.dropcol	2010-03-07 22:07:48 UTC (rev 41340)
@@ -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/releasebranch_6_4/scripts/i.fusion.brovey/i.fusion.brovey
===================================================================
--- grass/branches/releasebranch_6_4/scripts/i.fusion.brovey/i.fusion.brovey	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/i.fusion.brovey/i.fusion.brovey	2010-03-07 22:07:48 UTC (rev 41340)
@@ -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/releasebranch_6_4/scripts/m.proj/m.proj
===================================================================
--- grass/branches/releasebranch_6_4/scripts/m.proj/m.proj	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/m.proj/m.proj	2010-03-07 22:07:48 UTC (rev 41340)
@@ -154,7 +154,7 @@
 fi
 if [ -z "$IN_PROJ" ] ; then
    g.message -e "Missing input projection parameters."
-   rm -f "$TMP"
+   rm -f "$TEMPFILE"
    exit 1
 fi
 
@@ -178,8 +178,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
@@ -193,16 +193,16 @@
       read REPLY
       EXITCODE=$?
       if [ -n "$REPLY" ] ; then
-	 echo "$REPLY" >> "$TMP"
+	 echo "$REPLY" >> "$TMPFILE"
       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 "$TMPFILE" | cut -f1 -d' '`" -eq 0 ] ; then
       g.message -e "ERROR reading data from stdin"
       exit 1
    fi
-   infile="$TMP"
+   infile="$TMPFILE"
 else
    infile="$GIS_OPT_INPUT"
 fi
@@ -268,8 +268,8 @@
 fi
 
 #### cleanup
-if [ -e "$TMP" ] ; then
-   rm -f "$TMP"
+if [ -e "$TEMPFILE" ] ; then
+   rm -f "$TEMPFILE"
 fi
 
 exit 0

Modified: grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.gdalwarp
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.gdalwarp	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.gdalwarp	2010-03-07 22:07:48 UTC (rev 41340)
@@ -83,8 +83,8 @@
 g.message -d "[r.in.gdalwarp]"
 
 #### 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
@@ -96,7 +96,7 @@
 exitprocedure()
 {
 	g.message -e 'User break!'
-	rm -f "${TMP}"*
+	rm -f "${TEMPFILE}"*
 	exit 1
 }
 trap "exitprocedure" 2 3 15
@@ -118,7 +118,7 @@
 warpimport () {
 	FILE="$1"
 	MAP=$2
-	WARPFILE="${TMP}warped.geotiff"
+	WARPFILE="${TEMPFILE}warped.geotiff"
 	TMPMAPNAME=${2}_tmp
 
 	# Warp it and convert it to geotiff with alpha band to be sure we get nulls:
@@ -129,7 +129,7 @@
 
 	if [ $? -ne 0 ] ; then
 	    g.message -e message="`basename $0`: gdalwarp failure."
-	    rm -f "${TMP}"*
+	    rm -f "${TEMPFILE}"*
 	    exit 1
 	fi
 
@@ -137,7 +137,7 @@
 	r.in.gdal $FLAGS input="$WARPFILE" output="$TMPMAPNAME" --quiet
 	if [ $? -ne 0 ] ; then
 	    g.message -e message="`basename $0`: r.in.gdal failure."
-	    rm -f "${TMP}"*
+	    rm -f "${TEMPFILE}"*
 	    exit 1
 	fi
 
@@ -237,7 +237,7 @@
 	r.in.gdal -o $FLAGS input="$FILE" output="$MAP" --quiet
 	if [ $? -ne 0 ] ; then
 	    g.message -e message="`basename $0`: r.in.gdal failure."
-	    rm -f "${TMP}"*
+	    rm -f "${TEMPFILE}"*
 	    exit 1
 	fi
 
@@ -427,4 +427,4 @@
 fi
 
 # Clean up:
-rm -f "${TMP}"*
+rm -f "${TEMPFILE}"*

Modified: grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.wms
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.wms	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.wms	2010-03-07 22:07:48 UTC (rev 41340)
@@ -199,8 +199,8 @@
 fi
 
 #### 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
@@ -283,7 +283,7 @@
 	# is this bogus? won't PATH revert on exit anyway?
 	PATH="$prevPATH"
 	export PATH
-	\rm -f "${TMP}"*
+	\rm -f "${TEMPFILE}"*
 	exit 1
 }
 trap "exitprocedure" 2 3 15
@@ -331,7 +331,7 @@
 
 listLayers() {
 
-	CAPABILITIES_FILE="${TMP}capabilities.xml"
+	CAPABILITIES_FILE="${TEMPFILE}capabilities.xml"
 
 	STRING="service=WMS&request=GetCapabilities&${GIS_OPT_WMSQUERY}";
 	g.message -d message="POST-data: [$STRING]"
@@ -354,7 +354,7 @@
 
 	    if [ ! -e "$CAPABILITIES_FILE" ] ; then
 		g.message -e "Downloading XML file"
-		\rm "$TMP"
+		\rm "$TEMPFILE"
 		exit 1
 	    fi
 
@@ -382,13 +382,13 @@
 
 	if [ ! -e "$CAPABILITIES_FILE" ] ; then
 	    g.message -e "Downloading XML file"
-	    \rm "$TMP"
+	    \rm "$TEMPFILE"
 	    exit 1
 	fi
 
 	if [ `wc -c < "$CAPABILITIES_FILE"` -eq 0 ] ; then
 	     g.message -e "Downloaded XML file was empty"
-	     \rm -f "$CAPABILITIES_FILE" "$TMP"
+	     \rm -f "$CAPABILITIES_FILE" "$TEMPFILE"
 	     exit 1
 	fi
 
@@ -402,7 +402,7 @@
 		      -e "s/.*Layer\\/Abstract=/  |/" \
 		      -e "s/.*Layer\\/Style\\/Name=/  STYLE: /" \
 		      -e "s/.*Layer\\/Style\\/Title=/    Style title: /" \
-		  > "${TMP}capabilities.txt"
+		  > "${TEMPFILE}capabilities.txt"
 
 	else : # xml2 is not available
 		g.message -w "The 'xml2' program was not found. Proceeding with internal XML parsing which may not be as reliable."
@@ -421,21 +421,21 @@
 		      -e "s/<Title>\(.*\)<\/Title>/\t --\1 /" \
 		      -e "s/<\/Title>//" \
 		      -e "s/<\/*.*\/*\/*>//" \
-		    > "${TMP}capabilities.txt"
+		    > "${TEMPFILE}capabilities.txt"
 	fi
 
-	if [ `wc -l < "${TMP}capabilities.txt"` -eq 0 ] ; then
+	if [ `wc -l < "${TEMPFILE}capabilities.txt"` -eq 0 ] ; then
 	    g.message message=""
 	    g.message -e "Parsing XML file"
 	    g.message message="------------------------"
 	    cat "$CAPABILITIES_FILE"
 	else
-	    cat "${TMP}capabilities.txt"
+	    cat "${TEMPFILE}capabilities.txt"
 	fi
 	g.message message=""
 
 	if [ -e "$CAPABILITIES_FILE" ] ; then
-	    \rm -f "${TMP}capabilities.txt" "$TMP"
+	    \rm -f "${TEMPFILE}capabilities.txt" "$TEMPFILE"
 
 	    if [ -n "$GIS_OPT_CAP_FILE" ] ; then
 		mv "$CAPABILITIES_FILE" "$GIS_OPT_CAP_FILE"
@@ -555,7 +555,7 @@
   g.message "#################################"
   cat "$FILES"
   g.message message=""
-  \rm -f "${TMP}"*
+  \rm -f "${TEMPFILE}"*
   exit 1
 fi
 
@@ -592,6 +592,6 @@
 g.message -v message="Map <${GIS_OPT_OUTPUT}> written"
 
 # Clean up:
-\rm -f "${TMP}"*
+\rm -f "${TEMPFILE}"*
 
 exit

Modified: grass/branches/releasebranch_6_4/scripts/r.in.wms/wms.download
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.in.wms/wms.download	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/r.in.wms/wms.download	2010-03-07 22:07:48 UTC (rev 41340)
@@ -64,8 +64,8 @@
 g.message -d "[wms.download]"
 
 #### 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
@@ -92,7 +92,7 @@
 exitprocedure()
 {
 	g.message -e 'User break!'
-	rm -f "${TMP}"*
+	rm -f "${TEMPFILE}"*
 	exit 1
 }
 trap "exitprocedure" 2 3 15
@@ -212,5 +212,5 @@
 GetTiles
 
 # Clean up:
-rm -f "${TMP}"*
+rm -f "${TEMPFILE}"*
 

Modified: grass/branches/releasebranch_6_4/scripts/r.mask/r.mask
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.mask/r.mask	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/r.mask/r.mask	2010-03-07 22:07:48 UTC (rev 41340)
@@ -56,11 +56,11 @@
 fi
 
 # temp file
-TMP="r_mask_$$"
+TEMPRAST="r_mask_$$"
 
 cleanup()
 {
- g.remove --q rast=$TMP
+ g.remove --q rast=$TEMPRAST
 }
 
 # what to do in case of user break:
@@ -111,9 +111,9 @@
 	fi
 
         if [ "$GIS_FLAG_I" -eq 1 ]; then
-		g.rename --q rast=MASK,$TMP
-		r.mapcalc "MASK=if(isnull($TMP),1,null())"
-		g.remove --q rast=$TMP
+		g.rename --q rast=MASK,$TEMPRAST
+		r.mapcalc "MASK=if(isnull($TEMPRAST),1,null())"
+		g.remove --q rast=$TEMPRAST
 		g.message "Inverted MASK created. All subsequent raster operations"
 	else
 	  g.message "MASK created. All subsequent raster operations"

Modified: grass/branches/releasebranch_6_4/scripts/r.plane/r.plane
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.plane/r.plane	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/r.plane/r.plane	2010-03-07 22:07:48 UTC (rev 41340)
@@ -86,14 +86,14 @@
 fi
 
 #### 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
 
 #### trap ctrl-c so that we can clean up tmp
-trap 'rm -f "$TMP"*' 2 3 15
+trap 'rm -f "$TEMPFILE"*' 2 3 15
 
 # setting environment, so that awk works properly in all languages
 unset LC_ALL
@@ -180,7 +180,7 @@
 
 
 ### now the actual algorithm in awk (stored in a temporary file) ###
-cat > "$TMP" << EOF
+cat > "$TEMPFILE" << EOF
 
 {
 if (NR==1) {
@@ -246,13 +246,13 @@
 
 ### execute awk and remove temporary file ###
 
-awk  -f "$TMP" -v east=$e west=$w north=$n south=$s ea=$ea no=$no typeflag=$typeflag \
-  nsres=$nsres ewres=$ewres  dip=$dip az=$az el=$el "$TMP" > "$TMP".2
+awk  -f "$TEMPFILE" -v east=$e west=$w north=$n south=$s ea=$ea no=$no typeflag=$typeflag \
+  nsres=$nsres ewres=$ewres  dip=$dip az=$az el=$el "$TEMPFILE" > "$TEMPFILE".2
 
-rm -f "$TMP"
+rm -f "$TEMPFILE"
 
 g.message "Running r.in.ascii, please stand by.."
-r.in.ascii `echo $typeflag` i="$TMP".2 o=$name
+r.in.ascii `echo $typeflag` i="$TEMPFILE".2 o=$name
 
 r.support $name hist="$PROG name=$name dip=$dip azimuth=$az easting=$ea \\"
 r.support $name hist="northing=$no elevation=$el type=$type"
@@ -263,5 +263,5 @@
   aspect=$az degrees ccw from north."
 #echo "$dat, user: $user"
 
-rm -f "$TMP".2
+rm -f "$TEMPFILE".2
 

Modified: grass/branches/releasebranch_6_4/scripts/r.regression.line/r.regression.line
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.regression.line/r.regression.line	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/r.regression.line/r.regression.line	2010-03-07 22:07:48 UTC (rev 41340)
@@ -86,8 +86,8 @@
  exit 1
 fi
 
-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
@@ -96,13 +96,13 @@
 #calculate regression equation
 if [ $GIS_FLAG_S -eq 1 ] ; then
    # slower but accurate
-   r.stats -n1  input=$GIS_OPT_MAP1,$GIS_OPT_MAP2 | sed 's+$+ 1+g' > "$TMP"
+   r.stats -n1  input=$GIS_OPT_MAP1,$GIS_OPT_MAP2 | sed 's+$+ 1+g' > "$TEMPFILE"
 else
    # count "identical" pixels
-   r.stats -cnA input=$GIS_OPT_MAP1,$GIS_OPT_MAP2  > "$TMP"
+   r.stats -cnA input=$GIS_OPT_MAP1,$GIS_OPT_MAP2  > "$TEMPFILE"
 fi
 
-if [ ! -s "$TMP" ] ; then
+if [ ! -s "$TEMPFILE" ] ; then
     g.message -e "One or both input maps only contain no data (NULL) pixels in the current region"
     exit 1
 fi
@@ -115,16 +115,16 @@
 mediaX=sumX/tot;sumsqX=sumsqX/tot;varX=sumsqX-(mediaX^2);sdX=varX^0.5;\
 mediaY=sumY/tot;sumsqY=sumsqY/tot;varY=sumsqY-(mediaY^2);sdY=varY^0.5;\
 A=mediaY - B*mediaX; F= R^2/(1-R^2/tot-2);\
-print A, B, R, tot, F, mediaX, sdX, mediaY, sdY}' "$TMP" > "$TMP"b
+print A, B, R, tot, F, mediaX, sdX, mediaY, sdY}' "$TEMPFILE" > "$TEMPFILE"b
 
-echo "a b R N F medX sdX medY sdY" | tr -s ' ' '\n' > "$TMP"d
-cat "$TMP"b | tr -s ' ' '\n' > "$TMP"e
+echo "a b R N F medX sdX medY sdY" | tr -s ' ' '\n' > "$TEMPFILE"d
+cat "$TEMPFILE"b | tr -s ' ' '\n' > "$TEMPFILE"e
 
 #send output to screen or text file
 if [ -z "$GIS_OPT_OUTPUT" ] 
 then
 	if [ $GIS_FLAG_G -eq 1 ] ; then
-	   paste -d'=' "$TMP"d "$TMP"e
+	   paste -d'=' "$TEMPFILE"d "$TEMPFILE"e
 	else
 	   echo "y = a + b*x"
            echo "   a: offset"
@@ -134,24 +134,24 @@
            echo "   medX, medY: Means"
            echo "   sdX, sdY: Standard deviations"
            echo "a  b  R  N  F medX  sdX  medY  sdY"
-	   RESULTADO=`cat "$TMP"b`
+	   RESULTADO=`cat "$TEMPFILE"b`
            echo ${RESULTADO}
 	fi
 else
 	if [ $GIS_FLAG_G -eq 1 ] ; then
-	   paste -d'=' "$TMP"d "$TMP"e >> "$TMP"c
+	   paste -d'=' "$TEMPFILE"d "$TEMPFILE"e >> "$TEMPFILE"c
 	else
-	   echo "y = a + b*x" > "$TMP"c
-           echo "   a: offset" >> "$TMP"c
-           echo "   b: gain" >> "$TMP"c
-           echo "   R: sumXY - sumX*sumY/tot" >> "$TMP"c
-           echo "   N: number of elements" >> "$TMP"c
-           echo "   medX, medY: Means" >> "$TMP"c
-           echo "   sdX, sdY: Standard deviations" >> "$TMP"c
-           echo "a  b  R  N  F medX  sdX  medY  sdY" >> "$TMP"c
-	   cat "$TMP"b >> "$TMP"c
+	   echo "y = a + b*x" > "$TEMPFILE"c
+           echo "   a: offset" >> "$TEMPFILE"c
+           echo "   b: gain" >> "$TEMPFILE"c
+           echo "   R: sumXY - sumX*sumY/tot" >> "$TEMPFILE"c
+           echo "   N: number of elements" >> "$TEMPFILE"c
+           echo "   medX, medY: Means" >> "$TEMPFILE"c
+           echo "   sdX, sdY: Standard deviations" >> "$TEMPFILE"c
+           echo "a  b  R  N  F medX  sdX  medY  sdY" >> "$TEMPFILE"c
+	   cat "$TEMPFILE"b >> "$TEMPFILE"c
 	fi
-	mv "$TMP"c "$GIS_OPT_OUTPUT"
+	mv "$TEMPFILE"c "$GIS_OPT_OUTPUT"
 	cat "$GIS_OPT_OUTPUT"
 fi
-rm -f "$TMP" "$TMP"b "$TMP"c "$TMP"d "$TMP"e
+rm -f "$TEMPFILE" "$TEMPFILE"b "$TEMPFILE"c "$TEMPFILE"d "$TEMPFILE"e

Modified: grass/branches/releasebranch_6_4/scripts/r.univar.sh/r.univar.sh
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.univar.sh/r.univar.sh	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/r.univar.sh/r.univar.sh	2010-03-07 22:07:48 UTC (rev 41340)
@@ -65,8 +65,8 @@
 
 COVER="$GIS_OPT_MAP"
 
-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
@@ -74,7 +74,7 @@
 
 cleanup()
 {
-   \rm -f "$TMP" "$TMP.sort"
+   \rm -f "$TEMPFILE" "$TEMPFILE.sort"
 }
 
 # what to do in case of user break:
@@ -89,10 +89,10 @@
 
 g.message "Calculation for map $COVER (ignoring NULL cells)..."
 g.message "Reading raster map..."
-r.stats -1n input=$COVER > "$TMP"
+r.stats -1n input=$COVER > "$TEMPFILE"
 
 #check if map contains only NULL's in current region
-LINES=`wc -l "$TMP" | awk '{print $1}'`
+LINES=`wc -l "$TEMPFILE" | awk '{print $1}'`
 if [ "$LINES" -eq 0 ] ; then
  g.message -e "Map $COVER contains only NULL data in current region."
  cleanup
@@ -101,7 +101,7 @@
 
 # calculate statistics
 g.message "Calculating statistics..."
-cat "$TMP" | awk 'BEGIN {sum = 0.0 ; sum2 = 0.0}
+cat "$TEMPFILE" | awk 'BEGIN {sum = 0.0 ; sum2 = 0.0}
 function abs(x){return x < 0 ? -x : x}
 NR == 1{min = $1 ; max = $1}
        {sum += $1 ; sum2 += $1 * $1 ; sum3 += abs($1) ; N++}
@@ -124,14 +124,14 @@
 
 if [ $GIS_FLAG_E -eq 1 ] ; then
   #preparations:
-  cat "$TMP" | sort -n > "$TMP.sort"
-  NUMBER=`cat "$TMP.sort" | wc -l | awk '{print $1}'`
+  cat "$TEMPFILE" | sort -n > "$TEMPFILE.sort"
+  NUMBER=`cat "$TEMPFILE.sort" | wc -l | awk '{print $1}'`
   ODDEVEN=`echo $NUMBER | awk '{print $1%2}'`
 
   # 0.25 quartile
   QUARTILE=0.25
   QPOS=`echo $NUMBER $QUARTILE | awk '{printf "%d", $1 * $2 + 0.5}'`
-  QELEMENT=`head -n $QPOS "$TMP.sort" | tail -n 1`
+  QELEMENT=`head -n $QPOS "$TEMPFILE.sort" | tail -n 1`
   echo "1st Quartile: $QELEMENT"
 
   #Calculate median
@@ -141,13 +141,13 @@
    EVENMEDIANNUMBER=`expr $NUMBER / 2`
    EVENMEDIANNUMBERPLUSONE=`expr $EVENMEDIANNUMBER + 1`
    # select two numbers
-   SELECTEDNUMBERS=`cat "$TMP.sort" | head -n "$EVENMEDIANNUMBERPLUSONE" | tail -n 2`
+   SELECTEDNUMBERS=`cat "$TEMPFILE.sort" | head -n "$EVENMEDIANNUMBERPLUSONE" | tail -n 2`
    RESULTEVENMEDIAN=`echo $SELECTEDNUMBERS | awk '{printf "%f", ($1 + $2)/2.0}'`
    echo "Median (even N): $RESULTEVENMEDIAN"
   else
    # odd
    ODDMEDIANNUMBER=`echo $NUMBER | awk '{printf "%d", int($1/2+.5)}'`
-   RESULTODDMEDIAN=`cat "$TMP.sort" | head -n $ODDMEDIANNUMBER | tail -n 1 | awk '{printf "%f", $1}'`
+   RESULTODDMEDIAN=`cat "$TEMPFILE.sort" | head -n $ODDMEDIANNUMBER | tail -n 1 | awk '{printf "%f", $1}'`
    echo "Median (odd N): $RESULTODDMEDIAN"
   fi
 
@@ -155,13 +155,13 @@
   # 0.75 quartile
   QUARTILE=0.75
   QPOS=`echo $NUMBER $QUARTILE | awk '{printf "%d", $1 * $2 + 0.5}'`
-  QELEMENT=`head -n $QPOS "$TMP.sort" | tail -n 1`
+  QELEMENT=`head -n $QPOS "$TEMPFILE.sort" | tail -n 1`
   echo "3rd Quartile: $QELEMENT"
 
   # XX percentile
   QUARTILE=$GIS_OPT_PERCENTILE
   QPOS=`echo $NUMBER $QUARTILE | awk '{printf "%d", $1 * $2/100. + 0.5}'`
-  QELEMENT=`head -n $QPOS "$TMP.sort" | tail -1`
+  QELEMENT=`head -n $QPOS "$TEMPFILE.sort" | tail -1`
   echo "${GIS_OPT_PERCENTILE} Percentile: $QELEMENT"
 
 fi

Modified: grass/branches/releasebranch_6_4/scripts/v.colors/v.colors
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.colors/v.colors	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/v.colors/v.colors	2010-03-07 22:07:48 UTC (rev 41340)
@@ -114,8 +114,8 @@
 
 cleanup()
 {
-   if [ -n "$TMP" ] ; then
-      \rm "$TMP" "${TMP}_vcol.sql"
+   if [ -n "$TEMPFILE" ] ; then
+      \rm "$TEMPFILE" "${TEMPFILE}_vcol.sql"
    fi
    eval `g.findfile elem=windows file="tmp_vcolors.$$" | grep '^name='`
    if [ -n "$name" ] ; then
@@ -275,8 +275,8 @@
 
 
 
-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"
     cleanup
     exit 1
@@ -292,21 +292,21 @@
       #g.message message="LINE=[$LINE]"
       VALUE=`echo $LINE | cut -f1 -d'|'`
       COLR=`echo $LINE | cut -f2 -d'|'`
-      echo "UPDATE $TABLE SET $GIS_OPT_RGB_COLUMN = '$COLR' WHERE $GIS_OPT_COLUMN = $VALUE;" >> "${TMP}_vcol.sql"
+      echo "UPDATE $TABLE SET $GIS_OPT_RGB_COLUMN = '$COLR' WHERE $GIS_OPT_COLUMN = $VALUE;" >> "${TEMPFILE}_vcol.sql"
   done )
 
 
-if [ ! -e "${TMP}_vcol.sql" ] ; then
+if [ ! -e "${TEMPFILE}_vcol.sql" ] ; then
     g.message -e "No values found in color range"
     cleanup
     exit 1
 fi
 
 # apply SQL commands to update the table with values
-NUM_RULES=`wc -l < "${TMP}_vcol.sql"`
+NUM_RULES=`wc -l < "${TEMPFILE}_vcol.sql"`
 g.message "Writing $NUM_RULES colors ..."
-#less "$TMP"
-db.execute input="${TMP}_vcol.sql"
+#less "$TEMPFILE"
+db.execute input="${TEMPFILE}_vcol.sql"
 if [ $? -ne 0 ] ; then
    g.message -e "Processing SQL transaction"
    cleanup

Modified: grass/branches/releasebranch_6_4/scripts/v.db.dropcol/v.db.dropcol
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.db.dropcol/v.db.dropcol	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/v.db.dropcol/v.db.dropcol	2010-03-07 22:07:48 UTC (rev 41340)
@@ -65,15 +65,15 @@
 PROG=`basename $0`
 
 #### 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:
@@ -125,12 +125,12 @@
 if [ "$driver" = "sqlite" ] ; then
 	#echo "Using special trick for SQLite"
 	# http://www.sqlite.org/faq.html#q13
-	v.info --q -c map=$GIS_OPT_MAP layer=$GIS_OPT_LAYER | cut -d'|' -f1,2 | grep -v "|${col}$" > "$TMP.coldesc"
+	v.info --q -c map=$GIS_OPT_MAP layer=$GIS_OPT_LAYER | cut -d'|' -f1,2 | grep -v "|${col}$" > "$TEMPFILE.coldesc"
 	# need to revert order:
-	cat "$TMP.coldesc" | cut -d'|' -f1 > "$TMP.coltypes"
-	cat "$TMP.coldesc" | cut -d'|' -f2 > "$TMP.colnames"
-	COLDEF=`paste -d' ' "$TMP.colnames" "$TMP.coltypes" | tr '\n' ',' | sed 's+,$++g'`
-	COLNAMES=`cat "$TMP.colnames" | tr '\n' ',' | sed 's+,$++g'`
+	cat "$TEMPFILE.coldesc" | cut -d'|' -f1 > "$TEMPFILE.coltypes"
+	cat "$TEMPFILE.coldesc" | cut -d'|' -f2 > "$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};
@@ -138,8 +138,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/releasebranch_6_4/scripts/v.db.renamecol/v.db.renamecol
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.db.renamecol/v.db.renamecol	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/v.db.renamecol/v.db.renamecol	2010-03-07 22:07:48 UTC (rev 41340)
@@ -63,33 +63,20 @@
 
 PROG=`basename $0`
 
-#### setup temporary file
-TMP="`g.tempfile pid=$$`"
-if [ $? -ne 0 ] || [ -z "$TMP" ] ; then
-    g.message -e 'Unable to create temporary files'
-    exit 1
-fi
 
-cleanup()
-{
- \rm -f "$TMP" "$TMP.coltypes" "$TMP.colnames" "$TMP.coldesc"
-}
-
 # what to do in case of user break:
 exitprocedure()
 {
- g.message -e 'User break!'
- cleanup
- exit 1
+   g.message -e 'User break!'
+   exit 1
 }
 # shell check for user break (signal list: trap -l)
 trap "exitprocedure" 2 3 15
 
 error()
 {
-  g.message -e 'Cannot continue (problem renaming column)'
-  cleanup
-  exit 1
+   g.message -e 'Cannot continue (problem renaming column)'
+   exit 1
 }
 
 ### setup enviro vars ###
@@ -105,7 +92,6 @@
 table="`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w "^$GIS_OPT_LAYER" | cut -f2 -d';'`"
 if [ -z "$table" ] ; then
    g.message -e 'There is no table connected to the input vector map! Cannot rename any column'
-   cleanup
    exit 1
 fi
 
@@ -122,7 +108,6 @@
   if [ "$NAMELEN" -gt 11 ] ; then
    g.message -e "Column name <$newcol> too long. The DBF driver supports column names\
     not longer than 10 characters"
-   cleanup
    exit 1
   fi
 fi
@@ -130,16 +115,14 @@
 if [ "$oldcol" = "$keycol" ] ; then
    g.message -e "Cannot rename column <$oldcol> as it is needed to keep table <$table>\
      connected to the input vector map"
-   cleanup
    exit 1
 fi
 
 # old col there?
 v.info --quiet -c map="$GIS_OPT_MAP" layer=$GIS_OPT_LAYER | cut -d'|' -f1,2 | grep "|${oldcol}$" 2>&1 >/dev/null
 if [ $? -ne 0 ] ; then
-	g.message -e "Column <$oldcol> not found in table"
-	cleanup
-	exit 1
+   g.message -e "Column <$oldcol> not found in table"
+   exit 1
 fi
 
 # describe old col
@@ -160,8 +143,6 @@
 	echo "ALTER TABLE $table RENAME $oldcol TO $newcol" | db.execute database="${database}" driver=${driver} || error
 fi
 
-# cleanup
-cleanup
 
 # write cmd history:
 v.support map="${GIS_OPT_MAP}" cmdhist="${CMDLINE}"

Modified: grass/branches/releasebranch_6_4/scripts/v.db.univar/v.db.univar
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.db.univar/v.db.univar	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/v.db.univar/v.db.univar	2010-03-07 22:07:48 UTC (rev 41340)
@@ -77,15 +77,15 @@
 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
 
 cleanup()
 {
-   \rm -f "$TMP" "$TMP.sort"
+   \rm -f "$TEMPFILE" "$TEMPFILE.sort"
 }
 
 # what to do in case of user break:
@@ -115,9 +115,9 @@
 fi
 
 if [ -z "$GIS_OPT_WHERE" ] ; then
-   db.select table="$GIS_OPT_TABLE" ${db} ${drv} sql="select $GIS_OPT_COLUMN from $GIS_OPT_TABLE" -c > "$TMP"
+   db.select table="$GIS_OPT_TABLE" ${db} ${drv} sql="select $GIS_OPT_COLUMN from $GIS_OPT_TABLE" -c > "$TEMPFILE"
 else
-   db.select table="$GIS_OPT_TABLE" ${db} ${drv} sql="select $GIS_OPT_COLUMN from $GIS_OPT_TABLE WHERE $GIS_OPT_WHERE" -c > "$TMP"
+   db.select table="$GIS_OPT_TABLE" ${db} ${drv} sql="select $GIS_OPT_COLUMN from $GIS_OPT_TABLE WHERE $GIS_OPT_WHERE" -c > "$TEMPFILE"
 fi
 
 
@@ -130,7 +130,7 @@
 #echo ""
 
 #check if map contains only NULL's in current region
-LINES=`wc -l "$TMP" | awk '{print $1}'`
+LINES=`wc -l "$TEMPFILE" | awk '{print $1}'`
 if [ "$LINES" -eq 0 ] ; then
  g.message -e "Table $GIS_OPT_TABLE contains no data." 
  cleanup
@@ -139,7 +139,7 @@
 
 # calculate statistics
 g.message "Calculating statistics..."
-cat "$TMP" | awk 'BEGIN {sum = 0.0 ; sum2 = 0.0; min = 10e10 ; max = -min}
+cat "$TEMPFILE" | awk 'BEGIN {sum = 0.0 ; sum2 = 0.0; min = 10e10 ; max = -min}
 function abs(x){return x < 0 ? -x : x}
 (NF>0) {
 	sum += $1 ; sum2 += $1 * $1 ; sum3 += abs($1) ; N++;
@@ -167,14 +167,14 @@
 
 if [ $GIS_FLAG_E -eq 1 ] ; then
   #preparations:
-  cat "$TMP" | sort -n > "$TMP.sort"
-  NUMBER=`cat "$TMP.sort" | wc -l | awk '{print $1}'`
+  cat "$TEMPFILE" | sort -n > "$TEMPFILE.sort"
+  NUMBER=`cat "$TEMPFILE.sort" | wc -l | awk '{print $1}'`
   ODDEVEN=`echo $NUMBER | awk '{print $1%2}'`
 
   # 0.25 quartile
   QUARTILE=0.25
   QPOS=`echo $NUMBER $QUARTILE | awk '{printf "%d", $1 * $2 + 0.5}'`
-  QELEMENT=`head -n $QPOS "$TMP.sort" | tail -n 1`
+  QELEMENT=`head -n $QPOS "$TEMPFILE.sort" | tail -n 1`
   echo "1st Quartile: $QELEMENT"
 
   #Calculate median
@@ -184,13 +184,13 @@
    EVENMEDIANNUMBER=`expr $NUMBER / 2`
    EVENMEDIANNUMBERPLUSONE=`expr $EVENMEDIANNUMBER + 1`
    # select two numbers
-   SELECTEDNUMBERS=`cat "$TMP.sort" | head -n $EVENMEDIANNUMBERPLUSONE | tail -n 2`
+   SELECTEDNUMBERS=`cat "$TEMPFILE.sort" | head -n $EVENMEDIANNUMBERPLUSONE | tail -n 2`
    RESULTEVENMEDIAN=`echo $SELECTEDNUMBERS | awk '{printf "%f", ($1 + $2)/2.0}'`
    echo "Median (even N): $RESULTEVENMEDIAN"
   else
    # odd
    ODDMEDIANNUMBER=`echo $NUMBER | awk '{printf "%d", int($1/2+.5)}'`
-   RESULTODDMEDIAN=`cat "$TMP.sort" | head -n $ODDMEDIANNUMBER | tail -n 1 | awk '{printf "%f", $1}'`
+   RESULTODDMEDIAN=`cat "$TEMPFILE.sort" | head -n $ODDMEDIANNUMBER | tail -n 1 | awk '{printf "%f", $1}'`
    echo "Median (odd N): $RESULTODDMEDIAN"
   fi
 
@@ -198,13 +198,13 @@
   # 0.75 quartile
   QUARTILE=0.75
   QPOS=`echo $NUMBER $QUARTILE | awk '{printf "%d", $1 * $2 + 0.5}'`
-  QELEMENT=`head -n $QPOS "$TMP.sort" | tail -n 1`
+  QELEMENT=`head -n $QPOS "$TEMPFILE.sort" | tail -n 1`
   echo "3rd Quartile: $QELEMENT"
 
   # 0.90 percentile
   QUARTILE=0.9
   QPOS=`echo $NUMBER $QUARTILE | awk '{printf "%d", $1 * $2 + 0.5}'`
-  QELEMENT=`head -n $QPOS "$TMP.sort" | tail -n 1`
+  QELEMENT=`head -n $QPOS "$TEMPFILE.sort" | tail -n 1`
   echo "90th Percentile: $QELEMENT"
 
 fi

Modified: grass/branches/releasebranch_6_4/scripts/v.dissolve/v.dissolve
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.dissolve/v.dissolve	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/v.dissolve/v.dissolve	2010-03-07 22:07:48 UTC (rev 41340)
@@ -67,11 +67,11 @@
 fi
 
 #### setup temporary file
-TMP=$$
+TMPMAP="${GIS_OPT_OUTPUT}_$$"
 
 cleanup()
 {
-   g.remove vect="$GIS_OPT_OUTPUT"_${TMP} --quiet
+   g.remove vect="$TMPMAP" --quiet
 }
 
 # what to do in case of user break:
@@ -107,9 +107,9 @@
       g.message -e 'There is no table connected to this map!'
       exit 1
    fi
-   v.reclass input="$GIS_OPT_INPUT" output="$GIS_OPT_OUTPUT"_${TMP} layer="$GIS_OPT_LAYER" \
+   v.reclass input="$GIS_OPT_INPUT" output="$TMPMAP" layer="$GIS_OPT_LAYER" \
              column="$GIS_OPT_COLUMN"
-   v.extract -d input="$GIS_OPT_OUTPUT"_${TMP} output="$GIS_OPT_OUTPUT" type=area \
+   v.extract -d input="$TMPMAP" output="$GIS_OPT_OUTPUT" type=area \
              layer="$GIS_OPT_LAYER"
    cleanup
 fi

Modified: grass/branches/releasebranch_6_4/scripts/v.in.garmin/v.in.garmin
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.in.garmin/v.in.garmin	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/v.in.garmin/v.in.garmin	2010-03-07 22:07:48 UTC (rev 41340)
@@ -142,14 +142,14 @@
 
 
 #### 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
 
 #### trap ctrl-c so that we can clean up tmp
-trap 'rm -f "${TMP}"*' 2 3 15
+trap 'rm -f "${TEMPFILE}"*' 2 3 15
 
 
 #### process command line arguments
@@ -180,7 +180,7 @@
 
 if [ "`expr $GIS_FLAG_W + $GIS_FLAG_R + $GIS_FLAG_T`" -gt 1 ] ; then
     g.message -e "One feature at a time please. Use v.patch if you need to combine them."
-    rm -f "$TMP"
+    rm -f "$TEMPFILE"
     exit 1
 fi
 
@@ -207,13 +207,13 @@
 
 if [ "`expr $WPT + $TRK + $RTE`" -eq 0 ] ; then
     g.message -e "Must request either waypoints, route, or track."
-    rm -f "$TMP"
+    rm -f "$TEMPFILE"
     exit 1
 fi
 
 if [ $GIS_FLAG_Z -eq 1 ] &&  [ $TRK -ne 1 ] ; then
     g.message -e "3D import is only supported for tracks so far"
-    rm -f "$TMP"
+    rm -f "$TEMPFILE"
     exit 1
 fi
 
@@ -224,7 +224,7 @@
     gpstrans "$GPSPORT" -i 1> /dev/null
     if [ $? -ne 0 ] ; then
 	g.message -e message="Receiver on $GIS_OPT_PORT not responding, exiting"
-	rm -f "$TMP"
+	rm -f "$TEMPFILE"
 	exit 1
     fi
 elif [ $VERBOSE -eq 1 ] ; then
@@ -233,7 +233,7 @@
     gardump -u -p "$GIS_OPT_PORT" 1>&2
     if [ $? -ne 0 ] ; then
 	g.message -e message="Receiver on $GIS_OPT_PORT not responding, exiting"
-	rm -f "$TMP"
+	rm -f "$TEMPFILE"
 	exit 1
     fi
     g.message "GPS connection ok"
@@ -245,7 +245,7 @@
 PROJ_TYPE=`g.region -p | grep 'projection' | cut -f2 -d" "`
 if [ $PROJ_TYPE -eq 0 ] && [ $KEEP_WGS84 -ne 1 ] ; then
     g.message -e "Cannot project to a XY location."
-    rm -f "$TMP"
+    rm -f "$TEMPFILE"
     exit 1
 fi
 
@@ -254,57 +254,57 @@
 if [ $WPT -eq 1 ] ; then
     g.message "Receiving Waypoints..."
     if [ $GIS_FLAG_U -eq 0 ] ; then
-	gpstrans "$GPSPORT" -dw > "$TMP".gpst 2>/dev/null
+	gpstrans "$GPSPORT" -dw > "$TEMPFILE".gpst 2>/dev/null
 	EXITCODE=$?
     else
-	gardump -w -p "$GIS_OPT_PORT" > "$TMP".gard
+	gardump -w -p "$GIS_OPT_PORT" > "$TEMPFILE".gard
 	EXITCODE=$?
     fi
 fi
 if [ $RTE -eq 1 ] ; then
     g.message "Receiving Routes..."
     if [ $GIS_FLAG_U -eq 0 ] ; then
-	gpstrans "$GPSPORT" -dr > "$TMP".gpst 2>/dev/null
+	gpstrans "$GPSPORT" -dr > "$TEMPFILE".gpst 2>/dev/null
 	EXITCODE=$?
     else
-	gardump -r -p "$GIS_OPT_PORT" > "$TMP".gard
+	gardump -r -p "$GIS_OPT_PORT" > "$TEMPFILE".gard
 	EXITCODE=$?
     fi
 fi
 if [ $TRK -eq 1 ] ; then
     g.message "Receiving Tracks..."
     if [ $GIS_FLAG_U -eq 0 ] ; then
-	gpstrans "$GPSPORT" -dt > "$TMP".gpst 2>/dev/null
+	gpstrans "$GPSPORT" -dt > "$TEMPFILE".gpst 2>/dev/null
 	EXITCODE=$?
     else
-	gardump -t -p "$GIS_OPT_PORT" > "$TMP".gard
+	gardump -t -p "$GIS_OPT_PORT" > "$TEMPFILE".gard
 	EXITCODE=$?
     fi
 fi
 #### check success/failure
 if [ "$EXITCODE" -ne 0 ] ; then
     g.message -e "Retrieving data."
-    rm -f "${TMP}"*
+    rm -f "${TEMPFILE}"*
     exit 1
 fi
 
 if [ $GIS_FLAG_U -eq 0 ] ; then
-    if [ ! -e "${TMP}.gpst" ] || [ `wc -l < "${TMP}.gpst"` -le 1 ] ; then
+    if [ ! -e "${TEMPFILE}.gpst" ] || [ `wc -l < "${TEMPFILE}.gpst"` -le 1 ] ; then
 	g.message -w 'No Data! Exiting.'
-	rm -f "${TMP}"*
+	rm -f "${TEMPFILE}"*
 	exit 0
     fi
 else
-    if [ "`cat "${TMP}.gard" | grep -v '^\[' | grep -v '^#' -c`" -eq 0 ] ; then
+    if [ "`cat "${TEMPFILE}.gard" | grep -v '^\[' | grep -v '^#' -c`" -eq 0 ] ; then
 	g.message -w 'No Data! Exiting.'
-	rm -f "${TMP}"*
+	rm -f "${TEMPFILE}"*
 	exit 0
     fi
 fi
 
 if [ $GIS_FLAG_U -eq 0 ] ; then
     #### check which projection we are working with
-    PROJ="`head -n 1 "${TMP}.gpst" | sed -e 's/Format: //' | sed -e 's/  UTC.*//'`"
+    PROJ="`head -n 1 "${TEMPFILE}.gpst" | sed -e 's/Format: //' | sed -e 's/  UTC.*//'`"
     if [ $VERBOSE -eq 1 ] ; then
 	g.message message="Coordinate format: ${PROJ}"
     fi
@@ -313,10 +313,10 @@
 	# or DM.MM formatted input and I'm not going to start doing that sort
 	# of math in a shell script.
 	g.message -e message="Only DDD coordinates currently supported. [$PROJ]"
-	rm -f "${TMP}"*
+	rm -f "${TEMPFILE}"*
 	exit 1
     fi
-    IS_WGS84="`head -n 1 "$TMP".gpst | grep 'WGS 84'`"
+    IS_WGS84="`head -n 1 "$TEMPFILE".gpst | grep 'WGS 84'`"
 else
     # gardump
     IS_WGS84=TRUE
@@ -331,19 +331,19 @@
     if [ $GIS_FLAG_U -eq 0 ] ; then
         # gpstrans
 	if [ $WPT -eq 1 ] ; then
-	    cat "${TMP}.gpst" | sed -e '1d' | awk -F '\t' '{print $6 " " $5}' > "$TMP".base
-	    cat "${TMP}.gpst" | sed -e '1d' | cut -f1,2,3 | tr '\t' '|' > "$TMP".attributes
+	    cat "${TEMPFILE}.gpst" | sed -e '1d' | awk -F '\t' '{print $6 " " $5}' > "$TEMPFILE".base
+	    cat "${TEMPFILE}.gpst" | sed -e '1d' | cut -f1,2,3 | tr '\t' '|' > "$TEMPFILE".attributes
 	    ATTR_COLS='x DOUBLE PRECISION, y DOUBLE PRECISION, type VARCHAR(1), name VARCHAR(10), comments VARCHAR(40)'
 	fi
 	if [ $RTE -eq 1 ] ; then
-	    cat "${TMP}.gpst" | sed -e '1d' | grep '^W' | awk -F '\t' '{print $6 " " $5}' > "$TMP".base
-	    cat "${TMP}.gpst" | sed -e '1d' | grep '^W' | cut -f1,2,3 | tr '\t' '|' > "$TMP".attributes
+	    cat "${TEMPFILE}.gpst" | sed -e '1d' | grep '^W' | awk -F '\t' '{print $6 " " $5}' > "$TEMPFILE".base
+	    cat "${TEMPFILE}.gpst" | sed -e '1d' | grep '^W' | cut -f1,2,3 | tr '\t' '|' > "$TEMPFILE".attributes
 	    ATTR_COLS='x DOUBLE PRECISION, y DOUBLE PRECISION, type VARCHAR(1), name varchar(10), comments VARCHAR(40)'
 	fi
 	if [ $TRK -eq 1 ] ; then
 	    # we use uniq here as gpstrans can dupe up track points !?
-	    uniq "${TMP}.gpst" | sed -e '1d' | grep '^T' | awk -F '\t' '{print $4 " " $3}' > "$TMP".base
-	    uniq "${TMP}.gpst" | sed -e '1d' | grep '^T' | cut -f1,2 | tr '\t' '|' > "$TMP".attributes
+	    uniq "${TEMPFILE}.gpst" | sed -e '1d' | grep '^T' | awk -F '\t' '{print $4 " " $3}' > "$TEMPFILE".base
+	    uniq "${TEMPFILE}.gpst" | sed -e '1d' | grep '^T' | cut -f1,2 | tr '\t' '|' > "$TEMPFILE".attributes
 	    ATTR_COLS='x DOUBLE PRECISION, y DOUBLE PRECISION, type VARCHAR(1), localtime VARCHAR(40)'
 	    HAVE_ALT=FALSE
 	fi
@@ -352,7 +352,7 @@
 	if [ $WPT -eq 1 ] || [ $RTE -eq 1 ] ; then
 	    # **n [route name]
 	    # lat long [A:alt] [S:sym] [D:display] [I:id] [C:cmnt] [W:wpt info] [L:link]
-	    grep -E -v '^\[|^#|^\*\*' "${TMP}.gard" | awk '{print $2 " " $1}' > "$TMP".base
+	    grep -E -v '^\[|^#|^\*\*' "${TEMPFILE}.gard" | awk '{print $2 " " $1}' > "$TEMPFILE".base
 
 	    ROUTE_NUM=""
 	    ROUTE_NAME=""
@@ -381,11 +381,11 @@
 		fi
 
 		if [ $WPT -eq 1 ] ; then
-		    echo "$A_VAL|$S_VAL|$D_VAL|$I_VAL|$C_VAL|$W_VAL|$L_VAL" >> "$TMP".attributes
+		    echo "$A_VAL|$S_VAL|$D_VAL|$I_VAL|$C_VAL|$W_VAL|$L_VAL" >> "$TEMPFILE".attributes
 		elif [ $RTE -eq 1 ] ; then
-		    echo "$ROUTE_NUM|$ROUTE_NAME|$A_VAL|$S_VAL|$D_VAL|$I_VAL|$C_VAL|$W_VAL|$L_VAL" >> "$TMP".attributes
+		    echo "$ROUTE_NUM|$ROUTE_NAME|$A_VAL|$S_VAL|$D_VAL|$I_VAL|$C_VAL|$W_VAL|$L_VAL" >> "$TEMPFILE".attributes
 		fi
-	    done < "${TMP}.gard"
+	    done < "${TEMPFILE}.gard"
 
 	    if [ $WPT -eq 1 ] ; then
 		ATTR_COLS='x DOUBLE PRECISION, y DOUBLE PRECISION, altitude DOUBLE PRECISION, symbol INTEGER, smbl_flag INTEGER, name VARCHAR(15), comments VARCHAR(50), poi_code VARCHAR(40), poi_link VARCHAR(4)'
@@ -398,24 +398,24 @@
 	    # [yyyy-mm-dd hh:mm:ss] lat long [alt] [start]
 	    unset HAVE_ALT
 	    # some tracks don't have time/date, so we have to decide on the fly
-	    grep -v '^\[\|^#\|^Track:' "${TMP}.gard" | \
+	    grep -v '^\[\|^#\|^Track:' "${TEMPFILE}.gard" | \
 	      awk '{ if ( $0 ~ /..:..:../) {
 			print $4 " " $3
 		     } else {
 			print $2 " " $1
 		     }
-		   }' > "$TMP".base
+		   }' > "$TEMPFILE".base
 
-	    grep -v '^\[\|^#\|^Track:' "${TMP}.gard" | \
+	    grep -v '^\[\|^#\|^Track:' "${TEMPFILE}.gard" | \
 	      awk '{ if ( $0 ~ /..:..:../) {
 			print $1 "|" $2 "|" $5 "|" $6
 		     } else {
 			print "||" $3 "|" $4
 		     }
-		   }' > "$TMP.attr"
+		   }' > "$TEMPFILE.attr"
 
 	    # check if there is any altitude data
-	    if [ `cut -f3 -d'|' "$TMP.attr" | grep -c 'start'` -ge 1 ] ; then
+	    if [ `cut -f3 -d'|' "$TEMPFILE.attr" | grep -c 'start'` -ge 1 ] ; then
 		HAVE_ALT=FALSE
 		ATTR_COLS='x DOUBLE PRECISION, y DOUBLE PRECISION, gmt_date VARCHAR(10), gmt_time VARCHAR(8), new_track VARCHAR(5)'
 		if [ $GIS_FLAG_Z -eq 1 ] ; then
@@ -427,17 +427,17 @@
 	    fi
 
 	    # check if there is any track name data
-	    if [ `grep -c '^Track:' "${TMP}.gard"` -ge 1 ] ; then
+	    if [ `grep -c '^Track:' "${TEMPFILE}.gard"` -ge 1 ] ; then
 		ATTR_COLS="$ATTR_COLS, track_name VARCHAR(15)"
 
 		# create data for track name column
 # need extra if(TRK) else NULL stuff for v.in.ascii empty last column bug
-		grep -v '^\[\|^#' "${TMP}.gard" | awk \
+		grep -v '^\[\|^#' "${TEMPFILE}.gard" | awk \
 		  '/^Track:/ {TRK=$0; sub(/^Track: /, "", TRK)} ;
-		   /^[-0-9]/ {if(TRK) {print TRK} else {print "NULL"}}' > "$TMP.trackname"
-		paste -d'|' "$TMP.attr" "$TMP.trackname"  > "$TMP.attributes"
+		   /^[-0-9]/ {if(TRK) {print TRK} else {print "NULL"}}' > "$TEMPFILE.trackname"
+		paste -d'|' "$TEMPFILE.attr" "$TEMPFILE.trackname"  > "$TEMPFILE.attributes"
 	    else
-		cp "$TMP.attr" "$TMP.attributes"
+		cp "$TEMPFILE.attr" "$TEMPFILE.attributes"
 	    fi
 	fi
     fi
@@ -445,13 +445,13 @@
     #### reproject if needed (only consider 2D)
     if [ -z "$IS_WGS84" ] || [ $KEEP_WGS84 -eq 1 ] ; then
 	g.message "No projection transformation performed"
-	cp "${TMP}.base" "${TMP}.P_base"
+	cp "${TEMPFILE}.base" "${TEMPFILE}.P_base"
     else
 	g.message "Attempting waypoint projection transform with cs2cs..."
-	cs2cs -f %.7f $IN_PROJ +to $OUT_PROJ < "${TMP}.base" > "${TMP}.P_base"
+	cs2cs -f %.7f $IN_PROJ +to $OUT_PROJ < "${TEMPFILE}.base" > "${TEMPFILE}.P_base"
 	EXITCODE=$?
 	# check if transform REALLY worked (e.g. grid file not found)
-	BAD_PTS="`grep -c "^\*" "${TMP}.P_base"`"
+	BAD_PTS="`grep -c "^\*" "${TEMPFILE}.P_base"`"
 	if [ "$BAD_PTS" -gt 0 ] ; then
 	    g.message message=""
 	    g.message -w "$BAD_PTS point(s) failed reprojection."
@@ -460,46 +460,46 @@
 	if [ $EXITCODE -ne 0 ] ; then
 	    g.message -w "Projection transform failed, retaining WGS84"
 	    g.message message=""
-	    cp -f "${TMP}.base" "${TMP}.P_base"
+	    cp -f "${TEMPFILE}.base" "${TEMPFILE}.P_base"
 	fi
     fi
-    cat "${TMP}.P_base" | awk '{print $1 "|" $2}' > "${TMP}.vertices"
+    cat "${TEMPFILE}.P_base" | awk '{print $1 "|" $2}' > "${TEMPFILE}.vertices"
 
     #### and put back together
     # wpt list:   x|y|    W   MOB    04-OCT-03 08:07
-    paste -d"|" "$TMP".vertices "$TMP".attributes > "$TMP".asc
+    paste -d"|" "$TEMPFILE".vertices "$TEMPFILE".attributes > "$TEMPFILE".asc
 
 
     if [ -z "$NAME" ] ; then
 	g.message "ASCII file redirected to stdout"
-	cat "${TMP}.asc" 2> /dev/null
+	cat "${TEMPFILE}.asc" 2> /dev/null
     else
 	#### import into new ascii points file
 	if [ $WPT -eq 1 ] ; then
 	    g.message "Importing Waypoints..."
-	    v.in.ascii input="${TMP}.asc" output="$NAME" cat=0 columns="$ATTR_COLS" --quiet
+	    v.in.ascii input="${TEMPFILE}.asc" output="$NAME" cat=0 columns="$ATTR_COLS" --quiet
 	    EXITCODE=$?
 	fi
 	if [ $RTE -eq 1 ] ; then
 	    g.message "Importing Routes as points..."
-	    v.in.ascii input="${TMP}.asc" output="$NAME" cat=0 columns="$ATTR_COLS"
+	    v.in.ascii input="${TEMPFILE}.asc" output="$NAME" cat=0 columns="$ATTR_COLS"
 	    EXITCODE=$?
 	fi
 	if [ $TRK -eq 1 ] ; then
 	    if [ $GIS_FLAG_Z -eq 1 ] && [ "$HAVE_ALT" = "TRUE" ] ; then
 		g.message "Importing Track as 3D points..."
-		v.in.ascii input="${TMP}.asc" output="$NAME" cat=0 columns="$ATTR_COLS" -z z=5
+		v.in.ascii input="${TEMPFILE}.asc" output="$NAME" cat=0 columns="$ATTR_COLS" -z z=5
 		EXITCODE=$?
 	    else
 		g.message "Importing Track as points..."
-		v.in.ascii input="${TMP}.asc" output="$NAME" cat=0 columns="$ATTR_COLS"
+		v.in.ascii input="${TEMPFILE}.asc" output="$NAME" cat=0 columns="$ATTR_COLS"
 		EXITCODE=$?
 	    fi
 	fi
 
 	if [ $EXITCODE -ne 0 ] ; then
 	    g.message -e "While importing data with v.in.ascii"
-	    rm -f "${TMP}"*
+	    rm -f "${TEMPFILE}"*
 	    exit 1
 	fi
 
@@ -515,32 +515,32 @@
 	#### prepare line components
 	if [ $RTE -eq 1 ] ; then
 	    # add vertex counts
-	    cat "${TMP}.gpst" | sed -e '1d' | tac | awk 'BEGIN { FS="\t" ; R=0 } \
+	    cat "${TEMPFILE}.gpst" | sed -e '1d' | tac | awk 'BEGIN { FS="\t" ; R=0 } \
 		$1=="W" { printf(" %.7f %.7f\n", $6, $5) ; ++R } ; \
-		$1=="R" { printf("L %d 1\n", R) ; R=0 } END {;}' | tac > "${TMP}.base"
+		$1=="R" { printf("L %d 1\n", R) ; R=0 } END {;}' | tac > "${TEMPFILE}.base"
 
 	    # create attr table: cat(int), id number(int 0-19), name varchar(16+), starting_wpt(varchar 10)
-	    cat "${TMP}.gpst" | grep '^R' | cut -f2,3 | grep -n '^' | \
-		sed -e 's/:/\t/' > "${TMP}.route_ids"
-	    cat "${TMP}.gpst" | sed -e '1d' | grep '^R' -A 1 | grep '^W' | cut -f2 > "${TMP}.route_start"
-	    paste "${TMP}.route_ids" "${TMP}.route_start" > "${TMP}.route_atts"
-	    ATTR_FILE="${TMP}.route_atts"
+	    cat "${TEMPFILE}.gpst" | grep '^R' | cut -f2,3 | grep -n '^' | \
+		sed -e 's/:/\t/' > "${TEMPFILE}.route_ids"
+	    cat "${TEMPFILE}.gpst" | sed -e '1d' | grep '^R' -A 1 | grep '^W' | cut -f2 > "${TEMPFILE}.route_start"
+	    paste "${TEMPFILE}.route_ids" "${TEMPFILE}.route_start" > "${TEMPFILE}.route_atts"
+	    ATTR_FILE="${TEMPFILE}.route_atts"
 	    ATTR_COLS='cat INT, route_id INT, name VARCHAR(20), start_wpt VARCHAR(10)'
 
 	elif [ $TRK -eq 1 ] ; then
 	    # add vertex counts
-	    cat "${TMP}.gpst" | sed -e '1d' | tac | awk 'BEGIN { FS="\t" ; R=0 } \
+	    cat "${TEMPFILE}.gpst" | sed -e '1d' | tac | awk 'BEGIN { FS="\t" ; R=0 } \
 		$1=="T" { printf(" %.7f %.7f\n", $4, $3) ; ++R } ; \
-		$1=="" { printf("L %d 1\n", R) ; R=0 } END {;}' | tac > "${TMP}.base"
+		$1=="" { printf("L %d 1\n", R) ; R=0 } END {;}' | tac > "${TEMPFILE}.base"
 
 	    # create attr table: cat(int), start_time varchar(40), start_lat(double precision), start_lon(double precision), \
 	    #			    end_time varchar(40), end_lat(double precision), end_lon(double precision)
-	    cat "${TMP}.gpst" | sed -e '1d' | grep '^$' -B 1 | grep '^T' | cut -f2,3,4 > "${TMP}.end_time"
-	    cat "${TMP}.gpst" | grep '^T' | tail -n 1 | cut -f2,3,4 >> "${TMP}.end_time"
-	    cat "${TMP}.gpst" | sed -e '1d' | grep '^$' -A 1 | grep '^T' | cut -f2,3,4 | \
-		grep -n '^' | sed -e 's/:/\t/'  > "${TMP}.start_time"
-	    paste "${TMP}.start_time" "${TMP}.end_time" > "${TMP}.track_atts"
-	    ATTR_FILE="${TMP}.track_atts"
+	    cat "${TEMPFILE}.gpst" | sed -e '1d' | grep '^$' -B 1 | grep '^T' | cut -f2,3,4 > "${TEMPFILE}.end_time"
+	    cat "${TEMPFILE}.gpst" | grep '^T' | tail -n 1 | cut -f2,3,4 >> "${TEMPFILE}.end_time"
+	    cat "${TEMPFILE}.gpst" | sed -e '1d' | grep '^$' -A 1 | grep '^T' | cut -f2,3,4 | \
+		grep -n '^' | sed -e 's/:/\t/'  > "${TEMPFILE}.start_time"
+	    paste "${TEMPFILE}.start_time" "${TEMPFILE}.end_time" > "${TEMPFILE}.track_atts"
+	    ATTR_FILE="${TEMPFILE}.track_atts"
 	    ATTR_COLS='cat INT, start_time VARCHAR(40), start_lat DOUBLE PRECISION, start_lon DOUBLE PRECISION, end_time VARCHAR(40), end_lat DOUBLE PRECISION, end_lon DOUBLE PRECISION'
 	fi
 
@@ -548,27 +548,27 @@
 	# gardump
 	if [ $RTE -eq 1 ] ; then
 	    # add vertex counts
-	    grep -v '^\[\|^#' "${TMP}.gard" | tac | awk 'BEGIN { R=0 } \
+	    grep -v '^\[\|^#' "${TEMPFILE}.gard" | tac | awk 'BEGIN { R=0 } \
 		/^[-0-9]/ { printf(" %.7f %.7f\n", $2, $1) ; ++R } ; \
-		/^\*\*/ { printf("L %d 1\n", R) ; R=0 } END {;}' | tac > "${TMP}.base"
+		/^\*\*/ { printf("L %d 1\n", R) ; R=0 } END {;}' | tac > "${TEMPFILE}.base"
 
 	    # create attr table: cat(int), id number(int 0-19), name varchar(40), starting_wpt(varchar 15)
 	    # grep -n is to insert cat number, starting from 1. (route numbers start from 0)
-	    grep '^\*\*' "${TMP}.gard" | sed -e 's/^\*\*//' -e 's/ /|/' \
-	       | grep -n '^' | sed -e 's/:/|/' > "${TMP}.route_ids"
+	    grep '^\*\*' "${TEMPFILE}.gard" | sed -e 's/^\*\*//' -e 's/ /|/' \
+	       | grep -n '^' | sed -e 's/:/|/' > "${TEMPFILE}.route_ids"
 
-	    grep -A 1 '^\*\*' "${TMP}.gard" | grep -E -v '^\*\*|^--' | \
-	      sed -e 's/.* I://' | awk '{print $1}' > "${TMP}.route_start"
+	    grep -A 1 '^\*\*' "${TEMPFILE}.gard" | grep -E -v '^\*\*|^--' | \
+	      sed -e 's/.* I://' | awk '{print $1}' > "${TEMPFILE}.route_start"
 
-	    paste -d'|' "${TMP}.route_ids" "${TMP}.route_start" > "${TMP}.route_atts"
+	    paste -d'|' "${TEMPFILE}.route_ids" "${TEMPFILE}.route_start" > "${TEMPFILE}.route_atts"
 
-	    ATTR_FILE="${TMP}.route_atts"
+	    ATTR_FILE="${TEMPFILE}.route_atts"
 	    ATTR_COLS='cat int, route_id INT, name VARCHAR(40), start_wpt VARCHAR(15)'
 
 	elif [ $TRK -eq 1 ] ; then
 	    # add vertex counts
 	    # some tracks don't have time/date, so we have to decide on the fly
-	    grep -v '^\[\|^#\|^Track:' "${TMP}.gard" | tac | awk 'BEGIN { R=0 } \
+	    grep -v '^\[\|^#\|^Track:' "${TEMPFILE}.gard" | tac | awk 'BEGIN { R=0 } \
 	    ! /start/ {
 	      if($0 ~ /..:..:../ ) { printf(" %.7f %.7f\n", $4, $3) }
 	      else { printf(" %.7f %.7f\n", $2, $1) }
@@ -580,7 +580,7 @@
 	      else { printf(" %.7f %.7f\nL %d 1\n", $2, $1, R+1) }
 	      R=0
 	    }
-	    END {;}' | tac > "${TMP}.base"
+	    END {;}' | tac > "${TEMPFILE}.base"
 
 	    # create attr table: cat(int), \
 	    #  start_time varchar(40), start_lat(double precision), start_lon(double precision), \
@@ -592,16 +592,16 @@
 	    # - use grep -n to add "line number: string" for cat as track nums start as 0
 
 	    # crop out start times
-	    grep 'start$' "${TMP}.gard" | \
+	    grep 'start$' "${TEMPFILE}.gard" | \
 	      awk '{ if ( $0 ~ /..:..:../ ) {
 			print $1 "T" $2 "Z|" $3 "|" $4
 		     } else {
 			print "|" $1 "|" $2
 		     }
-		   }' | grep -n '^' | sed -e 's/:/|/' > "${TMP}.start_time"
+		   }' | grep -n '^' | sed -e 's/:/|/' > "${TEMPFILE}.start_time"
 
 	    # find and crop out end times. if only 1 pt in trk, use start as end time
-	    grep -v '^#\|^\[\|^Track:' "${TMP}.gard" | grep -B 1 'start$' | \
+	    grep -v '^#\|^\[\|^Track:' "${TEMPFILE}.gard" | grep -B 1 'start$' | \
 	      grep -v '^--' | awk 'BEGIN { FIRST=1 } \
 		/start/ {
 		  if (FIRST != 1) { print TIME "|" LAT "|" LON } else { FIRST=0 } ;
@@ -617,49 +617,49 @@
 		  } else {
 		    TIME=""; LAT=$1; LON=$2
 		  }
-		}' > "${TMP}.end_time"
+		}' > "${TEMPFILE}.end_time"
 
 	    # get time & coord of final point
-	    grep -B 1 'end transfer' "${TMP}.gard" | grep '^[0-9]' | awk \
+	    grep -B 1 'end transfer' "${TEMPFILE}.gard" | grep '^[0-9]' | awk \
 	       '{ if ( $0 ~ /..:..:../ ) {
 		    print $1 "T" $2 "Z|" $3 "|" $4
 		  } else {
 		    print "|" $1 "|" $2
 		  }
-		}' >> "${TMP}.end_time"
+		}' >> "${TEMPFILE}.end_time"
 
 	    ATTR_COLS='cat INT, start_time VARCHAR(40), start_lat DOUBLE PRECISION, start_lon DOUBLE PRECISION, end_time VARCHAR(40), end_lat DOUBLE PRECISION, end_lon DOUBLE PRECISION'
 
 	    # check if there is any track name data
 	    unset HAVE_TRACK_NAME
-	    if [ `grep -c '^Track:' "${TMP}.gard"` -ge 1 ] ; then
+	    if [ `grep -c '^Track:' "${TEMPFILE}.gard"` -ge 1 ] ; then
 		HAVE_TRACK_NAME=TRUE
 		ATTR_COLS="$ATTR_COLS, track_name VARCHAR(15)"
 
 		# extract data for track name column
-		grep -v '^\[\|^#' "${TMP}.gard" | grep '^Track:\|start' | awk \
+		grep -v '^\[\|^#' "${TEMPFILE}.gard" | grep '^Track:\|start' | awk \
 		  '/^Track:/ {TRK=$0; sub(/^Track: /, "", TRK)} ;
-		   /^[-0-9]/ {print TRK}' > "$TMP.trackname"
-		paste -d'|' "${TMP}.start_time" "${TMP}.end_time" "$TMP.trackname" > "${TMP}.track_atts"
+		   /^[-0-9]/ {print TRK}' > "$TEMPFILE.trackname"
+		paste -d'|' "${TEMPFILE}.start_time" "${TEMPFILE}.end_time" "$TEMPFILE.trackname" > "${TEMPFILE}.track_atts"
 	    else
 		HAVE_TRACK_NAME=FALSE
-		paste -d'|' "${TMP}.start_time" "${TMP}.end_time" > "${TMP}.track_atts"
+		paste -d'|' "${TEMPFILE}.start_time" "${TEMPFILE}.end_time" > "${TEMPFILE}.track_atts"
 	    fi
-	    ATTR_FILE="${TMP}.track_atts"
+	    ATTR_FILE="${TEMPFILE}.track_atts"
 	fi
     fi
 
     #### reproject if needed
     if [ -z "$IS_WGS84" ] || [ $KEEP_WGS84 -eq 1 ] ; then
 	g.message "No projection transformation performed"
-	cat "${TMP}.base" | awk 'BEGIN {;} $1=="L" { print } ; \
-	    $1!="L" { printf(" %.7f %.7f\n", $1, $2) } END {;}' > "${TMP}.P_base"
+	cat "${TEMPFILE}.base" | awk 'BEGIN {;} $1=="L" { print } ; \
+	    $1!="L" { printf(" %.7f %.7f\n", $1, $2) } END {;}' > "${TEMPFILE}.P_base"
     else
 	g.message "Attempting waypoint projection transform with cs2cs..."
-	cs2cs -tL -f %.7f $IN_PROJ +to $OUT_PROJ < "${TMP}.base" > "${TMP}.P_mid"
+	cs2cs -tL -f %.7f $IN_PROJ +to $OUT_PROJ < "${TEMPFILE}.base" > "${TEMPFILE}.P_mid"
 	EXITCODE=$?
 	# check if transform REALLY worked (e.g. grid file not found)
-	BAD_PTS="`grep -c "^\*" "${TMP}.P_mid"`"
+	BAD_PTS="`grep -c "^\*" "${TEMPFILE}.P_mid"`"
 	if [ "$BAD_PTS" -gt 0 ] ; then
 	    g.message message=""
 	    g.message -w "$BAD_PTS vertices failed reprojection."
@@ -668,24 +668,24 @@
 	if [ $EXITCODE -ne 0 ] ; then
 	    g.message -w "Projection transform failed, retaining WGS84"
 	    g.message message=""
-	    cat "${TMP}.base" | awk 'BEGIN {;} $1=="L" { print } ; \
-		$1!="L" { printf(" %.7f %.7f\n", $1, $2) } END {;}' > "${TMP}.P_base"
+	    cat "${TEMPFILE}.base" | awk 'BEGIN {;} $1=="L" { print } ; \
+		$1!="L" { printf(" %.7f %.7f\n", $1, $2) } END {;}' > "${TEMPFILE}.P_base"
 	else
-	    cat "${TMP}.P_mid" | awk 'BEGIN {;} $1=="L" { print } ; \
-		$1!="L" { printf(" %.7f %.7f\n", $1, $2) } END {;}' > "${TMP}.P_base"
+	    cat "${TEMPFILE}.P_mid" | awk 'BEGIN {;} $1=="L" { print } ; \
+		$1!="L" { printf(" %.7f %.7f\n", $1, $2) } END {;}' > "${TEMPFILE}.P_base"
 	fi
     fi
 
     # add category numbers
-    cat "${TMP}.P_base" | awk 'BEGIN { FS=" " ; R=0 } \
+    cat "${TEMPFILE}.P_base" | awk 'BEGIN { FS=" " ; R=0 } \
 	$1=="L" { printf(" 1 %d\nL %d 1\n", R, $2) ; ++R } ; \
-	$1!="L" { print } END { printf(" 1 %d\n", R) }' | sed -e '1d' > "${TMP}.P_baseC"
+	$1!="L" { print } END { printf(" 1 %d\n", R) }' | sed -e '1d' > "${TEMPFILE}.P_baseC"
 
     # add z for 3D maps
     unset HAVE_ALT
     if [ $GIS_FLAG_Z -eq 1 ] ; then
 	# check if there is any altitude data
-	if [ `grep -v '^\[\|^#\|^Track:' "${TMP}.gard" | tr -s ' ' '|' | cut -f6 -d'|' | grep -c start` -ge 1 ] ; then
+	if [ `grep -v '^\[\|^#\|^Track:' "${TEMPFILE}.gard" | tr -s ' ' '|' | cut -f6 -d'|' | grep -c start` -ge 1 ] ; then
 	    HAVE_ALT=TRUE
 	else
 	    HAVE_ALT=FALSE
@@ -699,28 +699,28 @@
 
     if [ "$HAVE_ALT" = "TRUE" ] ; then
 	# cut out altitude data and add blank lines between track lines
-	grep -v '^\[\|^#\|^Track:' "${TMP}.gard" | tac | \
+	grep -v '^\[\|^#\|^Track:' "${TEMPFILE}.gard" | tac | \
 	  awk '{ if($0 ~ /..:..:../ ) {
 		   print $5 " " $6
 		 } else {
 		   print $3 " " $4
 		 }
-	       }' | sed -e 's/ start/\n/' -e 's/ $//' | tac > "${TMP}.alt"
+	       }' | sed -e 's/ start/\n/' -e 's/ $//' | tac > "${TEMPFILE}.alt"
 
-	paste -d' ' "${TMP}.P_base" "${TMP}.alt" > "${TMP}.P_baseZ"
+	paste -d' ' "${TEMPFILE}.P_base" "${TEMPFILE}.alt" > "${TEMPFILE}.P_baseZ"
     else
-	cp "${TMP}.P_base" "${TMP}.P_baseZ"
+	cp "${TEMPFILE}.P_base" "${TEMPFILE}.P_baseZ"
     fi
 
     # add category numbers
-    cat "${TMP}.P_baseZ" | awk 'BEGIN { FS=" " ; R=0 } \
+    cat "${TEMPFILE}.P_baseZ" | awk 'BEGIN { FS=" " ; R=0 } \
 	$1=="L" { printf(" 1 %d\nL %d 1\n", R, $2) ; ++R } ; \
 	$1!="L" { print } END { printf(" 1 %d\n", R) }' | sed -e '1d' \
-	  > "${TMP}.P_baseC"
+	  > "${TEMPFILE}.P_baseC"
 
 
     #### create digit header
-    cat << EOF > "${TMP}.dig"
+    cat << EOF > "${TEMPFILE}.dig"
 ORGANIZATION: GRASSroots organization
 DIGIT DATE:   `date "+%Y/%m/%d"`
 DIGIT NAME:   $PROG
@@ -734,12 +734,12 @@
 EOF
 
     #### merge in vertices
-    cat "${TMP}.P_baseC" >> "${TMP}.dig"
+    cat "${TEMPFILE}.P_baseC" >> "${TEMPFILE}.dig"
 
     #### if no name for vector file given, cat to stdout
     if [ -z "$NAME" ] ; then
 	g.message "ASCII file redirected to stdout"
-	cat "${TMP}.dig" 2> /dev/null
+	cat "${TEMPFILE}.dig" 2> /dev/null
     else
 	#### import to binary vector file
 	if [ $GIS_FLAG_Z -eq 1 ] && [ "$HAVE_ALT" = "TRUE" ] ; then
@@ -749,14 +749,14 @@
 	fi
 
 	g.message "Importing with v.in.ascii..."
-	v.in.ascii format=standard output="$NAME" input="${TMP}.dig" $ZFLAG
+	v.in.ascii format=standard output="$NAME" input="${TEMPFILE}.dig" $ZFLAG
 
 	#### check success/failure
 	if [ $? -eq 0 ] ; then
 	    g.message -v message="Line vector <$NAME> successfully created"
 	else
 	    g.message -e "An error occured creating <$NAME>, please check"'!'
-	    rm -f "${TMP}"*
+	    rm -f "${TEMPFILE}"*
 	    exit 1
 	fi
 
@@ -771,7 +771,7 @@
 	echo "CREATE TABLE $NAME ($ATTR_COLS)" | db.execute
 	if [ $? -ne 0 ] ; then
 	    g.message -e "Map created but failed to create database table."
-	    rm -f "${TMP}"*
+	    rm -f "${TEMPFILE}"*
 	    exit 1
 	fi
 
@@ -810,7 +810,7 @@
 	    # need to connect it before we can delete it. :-/
 	    v.db.connect map="$NAME" table="$NAME" 2> /dev/null
 	    v.db.droptable -f map=$NAME --quiet
-	    rm -f "${TMP}"*
+	    rm -f "${TEMPFILE}"*
 	    exit 1
 	fi
 ### </hack>
@@ -832,7 +832,7 @@
 v.support map="$NAME" cmdhist="${CMDLINE}"
 
 #### clean up the mess
-\rm -f "${TMP}"*
+\rm -f "${TEMPFILE}"*
 
 #### end
 g.message "Done."

Modified: grass/branches/releasebranch_6_4/scripts/v.in.gpsbabel/v.in.gpsbabel
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.in.gpsbabel/v.in.gpsbabel	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/v.in.gpsbabel/v.in.gpsbabel	2010-03-07 22:07:48 UTC (rev 41340)
@@ -136,14 +136,14 @@
 fi
 
 #### set temporary files
-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
 
 #### trap ctrl-c so that we can clean up tmp
-trap 'rm -f "${TMP}."*' 2 3 15
+trap 'rm -f "${TEMPFILE}."*' 2 3 15
 
 
 #### process command line arguments 
@@ -171,13 +171,13 @@
 
 if [ $GIS_FLAG_W -eq 1 ] && ([ $GIS_FLAG_R -eq 1 ] || [ $GIS_FLAG_T -eq 1 ]) ; then
     g.message -e "One feature at a time please. Use v.patch if you need to combine them."
-    rm -f "${TMP}"
+    rm -f "${TEMPFILE}"
     exit 1
 fi
 # logic eludes me at pressent..  [combine with above]
 if [ $GIS_FLAG_R -eq 1 ] && [ $GIS_FLAG_T -eq 1 ] ; then
     g.message -e "One feature at a time please. Use v.patch if you need to combine them."
-    rm -f "${TMP}"
+    rm -f "${TEMPFILE}"
     exit 1
 fi
 
@@ -221,7 +221,7 @@
 
 if [ $PROJ_TYPE -eq 0 ] && [ $KEEP_WGS84 -ne 1 ] ; then
     g.message -e "Cannot project to a XY location."
-    rm -f "${TMP}"
+    rm -f "${TEMPFILE}"
     exit 1
 fi
 
@@ -251,12 +251,12 @@
     fi
 
     gpsbabel $TYPE -i $GIS_OPT_FORMAT -f "$GPSdevice" $PROGVERBOSE \
-	-o xcsv,style="$STYLE" -F "$TMP".xcsv
+	-o xcsv,style="$STYLE" -F "$TEMPFILE".xcsv
     EXITCODE=$?
 
-    if [ "`wc -l < "${TMP}.xcsv"`" -eq 0 ] ; then
+    if [ "`wc -l < "${TEMPFILE}.xcsv"`" -eq 0 ] ; then
 	g.message -w 'No data! Exiting.'
-	rm -f "${TMP}."*
+	rm -f "${TEMPFILE}."*
 	exit 0
     fi
 
@@ -271,14 +271,14 @@
 	EXITCODE=$?
     fi
     gpsbabel $TYPE -i $GIS_OPT_FORMAT -f "$GPSdevice" $PROGVERBOSE \
-	-o gpx -F "$TMP".gpx
+	-o gpx -F "$TEMPFILE".gpx
     EXITCODE=$?
 
     if [ $EXITCODE -eq 0 ] && \
-       [ "`grep -c '<rte>' "${TMP}.gpx"`" -eq 0 ] && \
-       [ "`grep -c '<trk>' "${TMP}.gpx"`" -eq 0 ] ; then
+       [ "`grep -c '<rte>' "${TEMPFILE}.gpx"`" -eq 0 ] && \
+       [ "`grep -c '<trk>' "${TEMPFILE}.gpx"`" -eq 0 ] ; then
 	g.message -e 'No data! Exiting.'
-	rm -f "${TMP}."*
+	rm -f "${TEMPFILE}."*
 	exit 0
     fi
 fi
@@ -286,7 +286,7 @@
 #### check success/failure
 if [ $EXITCODE -ne 0 ] ; then
     g.message -e "Error loading data from gpsbabel"
-    rm -f "${TMP}."*
+    rm -f "${TEMPFILE}."*
     exit 1
 fi
 
@@ -295,25 +295,25 @@
 if [ $CREATE_POINTS -eq 1 ] ; then
 ###################################
 
-    cat "${TMP}.xcsv" | cut -f 1,2 -d '|'| tr '|' ' '  > "$TMP".base
+    cat "${TEMPFILE}.xcsv" | cut -f 1,2 -d '|'| tr '|' ' '  > "$TEMPFILE".base
 # FIXME: if last field (comments) is empty it causes a not-enough fields error in v.in.ascii
 # FIXME: if altitude column is empty (1st attr) v.in.ascii complains as the column type is defined as 'double'
-    cat "${TMP}.xcsv" | tr '+' '|' | cut -f3,4,5,6 -d '|' | \
+    cat "${TEMPFILE}.xcsv" | tr '+' '|' | cut -f3,4,5,6 -d '|' | \
 	sed -e 's/-99999999.000000//' -e 's/|$/|_/' \
 	    -e 's/01\/01\/1970|00:00:00 AM/|/' \
-	    -e 's/^|/-9999|/'> "$TMP".attributes
+	    -e 's/^|/-9999|/'> "$TEMPFILE".attributes
 
 
     #### reproject if needed
     if [ "$IN_PROJ" = "$OUT_PROJ" ] || [ $KEEP_WGS84 -eq 1 ] ; then
 	g.message "No projection transformation performed" 
-	cp "${TMP}.base" "${TMP}.P_base"
+	cp "${TEMPFILE}.base" "${TEMPFILE}.P_base"
     else
 	g.message "Attempting waypoint projection transform with cs2cs" 
-	cs2cs -f %.7f $IN_PROJ +to $OUT_PROJ < "${TMP}.base" > "${TMP}.P_base"
+	cs2cs -f %.7f $IN_PROJ +to $OUT_PROJ < "${TEMPFILE}.base" > "${TEMPFILE}.P_base"
 	EXITCODE=$?
 	# check if transform REALLY worked (e.g. when the grid file is not found)
-	BAD_PTS="`grep -c "^\*" "${TMP}.P_base"`"
+	BAD_PTS="`grep -c "^\*" "${TEMPFILE}.P_base"`"
 	if [ "$BAD_PTS" -gt 0 ] ; then
 	    g.message message=""
 	    g.message -w "$BAD_PTS point(s) failed reprojection."
@@ -322,20 +322,20 @@
 	if [ $EXITCODE -ne 0 ] ; then
 	    g.message -w "Projection transform failed, retaining WGS84"
 	    g.message message=""
-	    cp -f "${TMP}.base" "${TMP}.P_base"
+	    cp -f "${TEMPFILE}.base" "${TEMPFILE}.P_base"
 	fi
     fi
 
-    cat "${TMP}.P_base" | awk '{print $1 "|" $2}' > "${TMP}.vertices"
+    cat "${TEMPFILE}.P_base" | awk '{print $1 "|" $2}' > "${TEMPFILE}.vertices"
 
     #### and put back together
     # wpt list:   x|y|<attr1>|...|<attr n>
-    paste -d"|" "$TMP".vertices "$TMP".attributes > "$TMP".asc
+    paste -d"|" "$TEMPFILE".vertices "$TEMPFILE".attributes > "$TEMPFILE".asc
 
     #### output or import
     if [ -z "$NAME" ] ; then
 	g.message "ASCII file redirected to stdout" 
-	cat "${TMP}.asc" 2> /dev/null
+	cat "${TEMPFILE}.asc" 2> /dev/null
     else
 	#### import into new points file
 	if [ $WPT -eq 1 ] ; then
@@ -346,14 +346,14 @@
 	    g.message "Importing Tracks as points..."
 	fi
 
-	v.in.ascii in="${TMP}.asc" output="$NAME" cat=0 \
+	v.in.ascii in="${TEMPFILE}.asc" output="$NAME" cat=0 \
 	  columns='x double precision, y double precision, altitude double precision, gmt_date varchar(10), gmt_time varchar(11), comments varchar(40)'
 	EXITCODE=$?
 
 	# EXITCODE also used at pgm termination below!
 	if [ $EXITCODE -ne 0 ] ; then
 	    g.message -e "While Importing data with v.in.ascii"
-	    rm -f "${TMP}"*
+	    rm -f "${TEMPFILE}"*
 	    exit 1
 	fi
     fi
@@ -370,51 +370,51 @@
 	# if someone has any suggest please mail!!!!
 
 	# list of bytes where routes finish
-	cat "$TMP.gpx" | grep -n "</rte>" > "$TMP.bytes"
+	cat "$TEMPFILE.gpx" | grep -n "</rte>" > "$TEMPFILE.bytes"
 	# number of routes
-	cat "$TMP.bytes" | grep -c "</rte>" > "$TMP.var"
+	cat "$TEMPFILE.bytes" | grep -c "</rte>" > "$TEMPFILE.var"
 	ROUTE_NUMBER=0 
-	read ROUTE_NUMBER < "$TMP.var" # route number to process
+	read ROUTE_NUMBER < "$TEMPFILE.var" # route number to process
 	READ_BYTES=0 # offset of bytes already read
-	cp "$TMP.gpx" "$TMP.gpx2" # file to be "eaten" by head commands in while 
+	cp "$TEMPFILE.gpx" "$TEMPFILE.gpx2" # file to be "eaten" by head commands in while 
 	ROUTE_ID=0 # route identifier
 
 	while [ "$ROUTE_NUMBER" -gt 0 ] ; do
-	    head -n 1 "$TMP.bytes" | cut -f 1 -d ':'> "$TMP.var"
+	    head -n 1 "$TEMPFILE.bytes" | cut -f 1 -d ':'> "$TEMPFILE.var"
 	    END_BYTE=0
-	    read END_BYTE < "$TMP.var" # this route ends at END_BYTE in $TMP.gpx file
+	    read END_BYTE < "$TEMPFILE.var" # this route ends at END_BYTE in $TEMPFILE.gpx file
 
 	    TO_READ=0
-	    TO_READ="`expr $END_BYTE - $READ_BYTES`"    # bytes to read from $TMP.gpx2 file 
+	    TO_READ="`expr $END_BYTE - $READ_BYTES`"    # bytes to read from $TEMPFILE.gpx2 file 
 	    READ_BYTES="`expr $READ_BYTES + $TO_READ`"  # update readed bytes
 
 	    # list of points in route
-	    head -n $TO_READ "$TMP.gpx2" | grep "<rtept" > "$TMP.points" 
+	    head -n $TO_READ "$TEMPFILE.gpx2" | grep "<rtept" > "$TEMPFILE.points" 
 	    POINTS=0 # number of points in route
-	    cat "$TMP.points" | grep -c "<rtept" > "$TMP.var"
-	    read POINTS < "$TMP.var"
-	    echo "L $POINTS 1" >> "$TMP.base"
+	    cat "$TEMPFILE.points" | grep -c "<rtept" > "$TEMPFILE.var"
+	    read POINTS < "$TEMPFILE.var"
+	    echo "L $POINTS 1" >> "$TEMPFILE.base"
 	    # read lat lon data
-	    cat "$TMP.points" | cut -f2 -d'<' | cut -f2,3 -d ' ' | cut -f2,4 -d '"' | tr '"' '\t' > "$TMP.latlon"
-	    cat "$TMP.latlon" | tr ',' '.' | awk '{printf(" %s %s\n", $2, $1) }' >> "$TMP.base"
+	    cat "$TEMPFILE.points" | cut -f2 -d'<' | cut -f2,3 -d ' ' | cut -f2,4 -d '"' | tr '"' '\t' > "$TEMPFILE.latlon"
+	    cat "$TEMPFILE.latlon" | tr ',' '.' | awk '{printf(" %s %s\n", $2, $1) }' >> "$TEMPFILE.base"
 	    # create attribute line
-	    head -n $TO_READ "$TMP.gpx2" | grep -n "<rtept" | head -n 1 | cut -f1 -d ':' > "$TMP.var"
+	    head -n $TO_READ "$TEMPFILE.gpx2" | grep -n "<rtept" | head -n 1 | cut -f1 -d ':' > "$TEMPFILE.var"
 	    OFFSET=0
-	    read OFFSET < "$TMP.var"
-	    head -n $OFFSET "$TMP.gpx2" > "$TMP.rte_attr"
+	    read OFFSET < "$TEMPFILE.var"
+	    head -n $OFFSET "$TEMPFILE.gpx2" > "$TEMPFILE.rte_attr"
 	    # read needed attributes
 	    ROUTE_ID="`expr $ROUTE_ID + 1`"
-	    cat "$TMP.rte_attr"| grep "<number" | tail -n 1 | cut -f2 -d'<' | cut -f2 -d'>' > "$TMP.var"
+	    cat "$TEMPFILE.rte_attr"| grep "<number" | tail -n 1 | cut -f2 -d'<' | cut -f2 -d'>' > "$TEMPFILE.var"
 	    NUMBER=0
-	    read NUMBER < "$TMP.var" # read the route number
-	    cat "$TMP.rte_attr"| grep "<name" | tail -n 1 | cut -f2 -d'<' | cut -f2 -d'>' > "$TMP.var"
+	    read NUMBER < "$TEMPFILE.var" # read the route number
+	    cat "$TEMPFILE.rte_attr"| grep "<name" | tail -n 1 | cut -f2 -d'<' | cut -f2 -d'>' > "$TEMPFILE.var"
 	    R_NAME=""
-	    read R_NAME < "$TMP.var" # read the route name
+	    read R_NAME < "$TEMPFILE.var" # read the route name
 
 	    OFFSET="`expr $TO_READ - $OFFSET`"
-	    head -n $TO_READ "$TMP.gpx2" | tail -n $OFFSET | grep "<name" | head -n 1 | cut -f2 -d'<' | cut -f2 -d'>' > "$TMP.var"
+	    head -n $TO_READ "$TEMPFILE.gpx2" | tail -n $OFFSET | grep "<name" | head -n 1 | cut -f2 -d'<' | cut -f2 -d'>' > "$TEMPFILE.var"
 	    START_PNT=""
-	    read START_PNT < "$TMP.var" # read the name of start point
+	    read START_PNT < "$TEMPFILE.var" # read the name of start point
 
 	    # check that numberic values don't try and pass an empty string
 ### variable names don't line up with column names ?!
@@ -427,84 +427,84 @@
 		g.message -w "Route $ROUTE_NUMBER: route ID was empty. Bug?"
 	    fi
 
-	    echo "$ROUTE_ID|$NUMBER|$R_NAME|$START_PNT" >> "$TMP.route_atts"
+	    echo "$ROUTE_ID|$NUMBER|$R_NAME|$START_PNT" >> "$TEMPFILE.route_atts"
 
 	    ROUTE_NUMBER="`expr $ROUTE_NUMBER - 1`"
 
 	    # eat files
-	    tail -n $ROUTE_NUMBER "$TMP.bytes" > "$TMP.bytes2"
-	    mv "$TMP.bytes2" "$TMP.bytes"
-	    head -n $TO_READ "$TMP.gpx2" > "$TMP.points"
+	    tail -n $ROUTE_NUMBER "$TEMPFILE.bytes" > "$TEMPFILE.bytes2"
+	    mv "$TEMPFILE.bytes2" "$TEMPFILE.bytes"
+	    head -n $TO_READ "$TEMPFILE.gpx2" > "$TEMPFILE.points"
 	    B_GPX=0
-	    wc -c < "$TMP.gpx2" > "$TMP.var"
-	    read B_GPX < "$TMP.var"
+	    wc -c < "$TEMPFILE.gpx2" > "$TEMPFILE.var"
+	    read B_GPX < "$TEMPFILE.var"
 	    B_PNT=0
-	    wc -c < "$TMP.points" > "$TMP.var"
-	    read B_PNT < "$TMP.var"
+	    wc -c < "$TEMPFILE.points" > "$TEMPFILE.var"
+	    read B_PNT < "$TEMPFILE.var"
 	    TO_READ="`expr $B_GPX - $B_PNT`"
-	    tail -c $TO_READ "$TMP.gpx2" > "$TMP.points"
-	    mv "$TMP.points" "$TMP.gpx2"
+	    tail -c $TO_READ "$TEMPFILE.gpx2" > "$TEMPFILE.points"
+	    mv "$TEMPFILE.points" "$TEMPFILE.gpx2"
 	done
 	# create attr table: cat(int), id number(int 0-19), name varchar(16+), starting_wpt(varchar 10)
-	ATTR_FILE="${TMP}.route_atts"
+	ATTR_FILE="${TEMPFILE}.route_atts"
 	ATTR_COLS='cat int, route_id int, name varchar(40), start_wpt varchar(40)'
     fi
 
     if [ $TRK -eq 1 ] ; then
 
 	# list of bytes where tracks finish
-	cat "$TMP.gpx" | grep -n "</trkseg>" > "$TMP.bytes"
+	cat "$TEMPFILE.gpx" | grep -n "</trkseg>" > "$TEMPFILE.bytes"
 	# number of tracks
-	cat "$TMP.bytes" | grep -c "</trkseg>" > "$TMP.var"
+	cat "$TEMPFILE.bytes" | grep -c "</trkseg>" > "$TEMPFILE.var"
 	TRACK_NUMBER=0 
-	read TRACK_NUMBER < "$TMP.var" # route number to process
+	read TRACK_NUMBER < "$TEMPFILE.var" # route number to process
 	READ_BYTES=0 # offset of bytes already read
-	cp "$TMP.gpx" "$TMP.gpx2" # file to be "eaten" by head commands in while 
+	cp "$TEMPFILE.gpx" "$TEMPFILE.gpx2" # file to be "eaten" by head commands in while 
 	TRACK_ID=0 # track identifier
 	while [ "$TRACK_NUMBER" -gt 0 ] ; do
-	    head -n 1 "$TMP.bytes" | cut -f 1 -d ':'> "$TMP.var"
+	    head -n 1 "$TEMPFILE.bytes" | cut -f 1 -d ':'> "$TEMPFILE.var"
 	    END_BYTE=0
-	    read END_BYTE < "$TMP.var" # this route ends at END_BYTE in $TMP.gpx file
+	    read END_BYTE < "$TEMPFILE.var" # this route ends at END_BYTE in $TEMPFILE.gpx file
 	    TO_READ=0
 
-	    TO_READ="`expr $END_BYTE - $READ_BYTES`"    # bytes to read from $TMP.gpx2 file 
+	    TO_READ="`expr $END_BYTE - $READ_BYTES`"    # bytes to read from $TEMPFILE.gpx2 file 
 	    READ_BYTES="`expr $READ_BYTES + $TO_READ`"  # update readed bytes
 
 	    # list of points in route
-	    head -n $TO_READ "$TMP.gpx2" | grep "<trkpt" > "$TMP.points" 
+	    head -n $TO_READ "$TEMPFILE.gpx2" | grep "<trkpt" > "$TEMPFILE.points" 
 	    POINTS=0 # number of points in track 
-	    cat "$TMP.points" | grep -c "<trkpt" > "$TMP.var"
-	    read POINTS < "$TMP.var"
-	    echo "L $POINTS 1" >> "$TMP.base"
+	    cat "$TEMPFILE.points" | grep -c "<trkpt" > "$TEMPFILE.var"
+	    read POINTS < "$TEMPFILE.var"
+	    echo "L $POINTS 1" >> "$TEMPFILE.base"
 	    # read lat lon data
-	    cat "$TMP.points" | cut -f2 -d'<' | cut -f2,3 -d ' ' | cut -f2,4 -d '"' | tr '"' '\t' > "$TMP.latlon"
-	    cat "$TMP.latlon" | tr ',' '.' | awk '{printf(" %s %s\n", $2, $1) }' >> "$TMP.base"
+	    cat "$TEMPFILE.points" | cut -f2 -d'<' | cut -f2,3 -d ' ' | cut -f2,4 -d '"' | tr '"' '\t' > "$TEMPFILE.latlon"
+	    cat "$TEMPFILE.latlon" | tr ',' '.' | awk '{printf(" %s %s\n", $2, $1) }' >> "$TEMPFILE.base"
 	    # create attribute line
-	    head -n $TO_READ "$TMP.gpx2" | grep -n "<trk" | head -n 1 | cut -f1 -d ':' > "$TMP.var"
+	    head -n $TO_READ "$TEMPFILE.gpx2" | grep -n "<trk" | head -n 1 | cut -f1 -d ':' > "$TEMPFILE.var"
 	    OFFSET=0
-	    read OFFSET < "$TMP.var"
+	    read OFFSET < "$TEMPFILE.var"
 	    S_LAT=""
-	    head -n 1 "$TMP.latlon" | cut -f1 > "$TMP.var"
-	    read S_LAT < "$TMP.var"
+	    head -n 1 "$TEMPFILE.latlon" | cut -f1 > "$TEMPFILE.var"
+	    read S_LAT < "$TEMPFILE.var"
 	    S_LON=""
-	    head -n 1 "$TMP.latlon" | cut -f2 > "$TMP.var"
-	    read S_LON < "$TMP.var"
+	    head -n 1 "$TEMPFILE.latlon" | cut -f2 > "$TEMPFILE.var"
+	    read S_LON < "$TEMPFILE.var"
 	    E_LAT=""
-	    tail -n 1 "$TMP.latlon" | cut -f1 > "$TMP.var"
-	    read E_LAT < "$TMP.var"
+	    tail -n 1 "$TEMPFILE.latlon" | cut -f1 > "$TEMPFILE.var"
+	    read E_LAT < "$TEMPFILE.var"
 	    E_LON=""
-	    tail -n 1 "$TMP.latlon" | cut -f2 > "$TMP.var"
-	    read E_LON < "$TMP.var"
+	    tail -n 1 "$TEMPFILE.latlon" | cut -f2 > "$TEMPFILE.var"
+	    read E_LON < "$TEMPFILE.var"
 
 	    OFFSET="`expr $TO_READ - $OFFSET`"
 
-	    head -n $TO_READ "$TMP.gpx2" | tail -n $OFFSET | grep "<time" > "$TMP.time"
+	    head -n $TO_READ "$TEMPFILE.gpx2" | tail -n $OFFSET | grep "<time" > "$TEMPFILE.time"
 	    S_TIME=""
-	    head -n 1 "$TMP.time" | cut -f 2 -d'>' | cut -f1 -d'<' > "$TMP.var"
-	    read S_TIME < "$TMP.var"
+	    head -n 1 "$TEMPFILE.time" | cut -f 2 -d'>' | cut -f1 -d'<' > "$TEMPFILE.var"
+	    read S_TIME < "$TEMPFILE.var"
 	    E_TIME=""
-	    tail -n 1 "$TMP.time" | cut -f 2 -d'>' | cut -f1 -d'<' > "$TMP.var"
-	    read E_TIME < "$TMP.var"
+	    tail -n 1 "$TEMPFILE.time" | cut -f 2 -d'>' | cut -f1 -d'<' > "$TEMPFILE.var"
+	    read E_TIME < "$TEMPFILE.var"
 
 	    TRACK_ID="`expr $TRACK_ID + 1`"
 
@@ -530,31 +530,31 @@
 		g.message -w "Track $TRACK_NUMBER:  ending lon was empty. Bug?"
 	    fi
 
-	    echo "$TRACK_ID|$S_TIME|$S_LAT|$S_LON|$E_TIME|$E_LAT|$E_LON" >> "$TMP.track_atts"
+	    echo "$TRACK_ID|$S_TIME|$S_LAT|$S_LON|$E_TIME|$E_LAT|$E_LON" >> "$TEMPFILE.track_atts"
 
 	    TRACK_NUMBER="`expr $TRACK_NUMBER - 1`"
 
 	    # eat files
-	    tail -n $TRACK_NUMBER "$TMP.bytes" > "$TMP.bytes2"
-	    mv "$TMP.bytes2" "$TMP.bytes"
-	    head -n $TO_READ "$TMP.gpx2" > "$TMP.points"
+	    tail -n $TRACK_NUMBER "$TEMPFILE.bytes" > "$TEMPFILE.bytes2"
+	    mv "$TEMPFILE.bytes2" "$TEMPFILE.bytes"
+	    head -n $TO_READ "$TEMPFILE.gpx2" > "$TEMPFILE.points"
 	    B_GPX=0
-	    wc -c < "$TMP.gpx2" > "$TMP.var"
-	    read B_GPX < "$TMP.var"
+	    wc -c < "$TEMPFILE.gpx2" > "$TEMPFILE.var"
+	    read B_GPX < "$TEMPFILE.var"
 	    B_PNT=0
-	    wc -c < "$TMP.points" > "$TMP.var"
-	    read B_PNT < "$TMP.var"
+	    wc -c < "$TEMPFILE.points" > "$TEMPFILE.var"
+	    read B_PNT < "$TEMPFILE.var"
 
 	    TO_READ="`expr $B_GPX - $B_PNT`"
 	    
-	    tail -c $TO_READ "$TMP.gpx2" > "$TMP.points"
-	    mv "$TMP.points" "$TMP.gpx2"
+	    tail -c $TO_READ "$TEMPFILE.gpx2" > "$TEMPFILE.points"
+	    mv "$TEMPFILE.points" "$TEMPFILE.gpx2"
 	done
 
 	# create attr table: cat(int), start_time varchar(40), start_lat(double precision), start_lon(double precision), \
 	#			end_time varchar(40), end_lat(double precision), end_lon(double precision)
 	
-	ATTR_FILE="${TMP}.track_atts"
+	ATTR_FILE="${TEMPFILE}.track_atts"
 	ATTR_COLS='cat int, start_time varchar(40), start_lat double precision, start_lon double precision, end_time varchar(40), end_lat double precision, end_lon double precision'
     fi
 
@@ -562,14 +562,14 @@
     #### reproject if needed
     if [ "$IN_PROJ" = "$OUT_PROJ" ] || [ $KEEP_WGS84 -eq 1 ] ; then
 	g.message "No projection transformation performed" 
-	cat "${TMP}.base" | awk 'BEGIN {;} $1=="L" { print } ; \
-	    $1!="L" { " %s %s\n", $1, $2) } END {;}' > "${TMP}.P_base"
+	cat "${TEMPFILE}.base" | awk 'BEGIN {;} $1=="L" { print } ; \
+	    $1!="L" { " %s %s\n", $1, $2) } END {;}' > "${TEMPFILE}.P_base"
     else
 	g.message "Attempting waypoint projection transform with cs2cs" 
-	cs2cs -tL -f %.7f $IN_PROJ +to $OUT_PROJ < "${TMP}.base" > "${TMP}.P_mid"
+	cs2cs -tL -f %.7f $IN_PROJ +to $OUT_PROJ < "${TEMPFILE}.base" > "${TEMPFILE}.P_mid"
 	EXITCODE=$?
 	 # check if transform REALLY worked (e.g. grid file not found)
-	 BAD_PTS="`grep -c "^\*" "${TMP}.P_mid"`"
+	 BAD_PTS="`grep -c "^\*" "${TEMPFILE}.P_mid"`"
 	if [ "$BAD_PTS" -gt 0 ] ; then
 	    g.message message=""
 	    g.message -w "$BAD_PTS vertices failed reprojection."
@@ -578,22 +578,22 @@
 	if [ $EXITCODE -ne 0 ] ; then
 	    g.message "Projection transform failed, retaining WGS84" 
 	    g.message message=""
-	    cat "${TMP}.base" | awk 'BEGIN {;} $1=="L" { print } ; \
-		$1!="L" { printf(" %s %s\n", $1, $2) } END {;}' > "${TMP}.P_base"
+	    cat "${TEMPFILE}.base" | awk 'BEGIN {;} $1=="L" { print } ; \
+		$1!="L" { printf(" %s %s\n", $1, $2) } END {;}' > "${TEMPFILE}.P_base"
 	else
-	    cat "${TMP}.P_mid" | awk 'BEGIN {;} $1=="L" { print } ; \
-		$1!="L" { printf(" %s %s\n", $1, $2) } END {;}' > "${TMP}.P_base"
+	    cat "${TEMPFILE}.P_mid" | awk 'BEGIN {;} $1=="L" { print } ; \
+		$1!="L" { printf(" %s %s\n", $1, $2) } END {;}' > "${TEMPFILE}.P_base"
 	fi
     fi
 
     # add category numbers
-    cat "${TMP}.P_base" | awk 'BEGIN { FS=" " ; R=0 } \
+    cat "${TEMPFILE}.P_base" | awk 'BEGIN { FS=" " ; R=0 } \
 	$1=="L" { printf(" 1 %d\nL %d 1\n", R, $2) ; ++R } ; \
-	$1!="L" { print } END { printf(" 1 %d\n", R) }' | sed -e '1d' > "${TMP}.P_baseC"
+	$1!="L" { print } END { printf(" 1 %d\n", R) }' | sed -e '1d' > "${TEMPFILE}.P_baseC"
 
 
     #### create digit header
-    cat << EOF > "${TMP}.dig"
+    cat << EOF > "${TEMPFILE}.dig"
 ORGANIZATION: GRASSroots organization
 DIGIT DATE:   `date "+%Y/%m/%d"`
 DIGIT NAME:   $PROG
@@ -608,16 +608,16 @@
 
     #### merge in vertices
 #HB#?? locale test fixed this
-    cat "${TMP}.P_baseC" | tr ',' '.' >> "${TMP}.dig"
+    cat "${TEMPFILE}.P_baseC" | tr ',' '.' >> "${TEMPFILE}.dig"
 
     #### if no name for vector file given, cat to stdout
     if [ -z "$NAME" ] ; then
 	g.message "ASCII file redirected to stdout" 
-	cat "${TMP}.dig" 2> /dev/null
+	cat "${TEMPFILE}.dig" 2> /dev/null
     else
 	#### import to binary vector file 
 	g.message "Importing with v.in.ascii" 
-	v.in.ascii format=standard output="$NAME" input="${TMP}.dig"
+	v.in.ascii format=standard output="$NAME" input="${TEMPFILE}.dig"
 
 	#### check success/failure
 	if [ $? -eq 0 ] ; then
@@ -680,7 +680,7 @@
 v.support map="$NAME" cmdhist="${CMDLINE}"
 
 #### clean up the mess
-rm -f "${TMP}."* "${TMP}"
+rm -f "${TEMPFILE}."* "${TEMPFILE}"
 
 #### end
 g.message "Done." 

Modified: grass/branches/releasebranch_6_4/scripts/v.in.mapgen/v.in.mapgen
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.in.mapgen/v.in.mapgen	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/v.in.mapgen/v.in.mapgen	2010-03-07 22:07:48 UTC (rev 41340)
@@ -104,14 +104,14 @@
 fi
 
 #### setup temporary file
-TMP="`g.tempfile pid=$$`"
-if [ $? -ne 0 ] || [ -z "$TMP" ] ; then
+TMPFILE="`g.tempfile pid=$$`"
+if [ $? -ne 0 ] || [ -z "$TMPFILE" ] ; then
     g.message -e "unable to create temporary files"
     exit 1
 fi
 
 #### trap ctrl-c so that we can clean up tmp
-trap 'rm -f "$TMP"' 2 3 15
+trap 'rm -f "$TMPFILE"' 2 3 15
 
 #### create ascii vector file
 if [ $GIS_FLAG_F -eq 1 ] ; then
@@ -122,7 +122,7 @@
   #  tac $FILE | $AWK 'BEGIN { FS="," ; R=0 }
   #    $1~/\d*/   { printf("L %d\n", R) }
   #    $1~/   .*/ { printf(" %lf %lf\n", $2, $1) ; ++R }
-  #    $1~/END/   { }' | tac > "$TMP"
+  #    $1~/END/   { }' | tac > "$TMPFILE"
 
   ## matlab format. Cleanse with NaN->nan and spaces to tabs
   tac "$FILE" | awk '{print $1 "\t" $2 "\t" $3}
@@ -133,7 +133,7 @@
     $1~/nan.*/ { printf("L %d\n", R) ; R=0 }
     $1~/\d*\.\d*/ { printf(" %.8f %.8f %.8f\n", $1, $2, $3) ; ++R }
     END {;}' | \
-   grep -v "^L 0$" | tac > "$TMP"
+   grep -v "^L 0$" | tac > "$TMPFILE"
 
 else
   ## mapgen format.
@@ -141,11 +141,11 @@
     BEGIN { FS="\t" ; R=0 }
     $1~/#.*/ { printf("L %d\n", R) ; R=0 }
     $1~/\d*\.\d*/ { printf(" %.8f %.8f\n", $1, $2) ; ++R }
-    END {;}' | tac > "$TMP"
+    END {;}' | tac > "$TMPFILE"
 fi
 
 #### create digit header
-cat << EOF > "${TMP}.dig"
+cat << EOF > "${TMPFILE}.dig"
 ORGANIZATION: GRASSroots organization
 DIGIT DATE:   `date +%D`
 DIGIT NAME:   $PROG
@@ -159,16 +159,16 @@
 EOF
 
 #### process points list to ascii vector file (merge in vertices)
-cat "${TMP}" >> "${TMP}.dig"
+cat "${TMPFILE}" >> "${TMPFILE}.dig"
 
 #### if no name for vector file given, cat to stdout
 if [ "$NAME" = "" ] ; then
     g.message "Output to stdout" 
-    cat "${TMP}.dig" 2>/dev/null
+    cat "${TMPFILE}.dig" 2>/dev/null
 else
     #### import to binary vector file
     g.message "Importing with v.in.ascii ..." 
-    v.in.ascii $do3D input="${TMP}.dig" output="$NAME" format=standard
+    v.in.ascii $do3D input="${TMPFILE}.dig" output="$NAME" format=standard
 
     #### check success/failure
     if [ $? -eq 0 ] ; then
@@ -179,7 +179,7 @@
 fi
 
 #### clean up the mess
-rm -f "$TMP" "${TMP}.dig"
+rm -f "$TMPFILE" "${TMPFILE}.dig"
 
 #### end
 exit 0

Modified: grass/branches/releasebranch_6_4/scripts/v.in.wfs/v.in.wfs
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.in.wfs/v.in.wfs	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/v.in.wfs/v.in.wfs	2010-03-07 22:07:48 UTC (rev 41340)
@@ -61,28 +61,28 @@
     exit 1
 fi
 
-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
 
-OUT=$GIS_OPT_output
+OUT="$GIS_OPT_output"
 WFS_URL="$GIS_OPT_WFS"
 
 g.message "Retrieving data ..."
-curl "$WFS_URL" > "$TMP.xml"
+curl "$WFS_URL" > "$TEMPFILE.xml"
 
-v.in.ogr dsn="$TMP.xml" out=$OUT -o
+v.in.ogr dsn="$TEMPFILE.xml" out=$OUT -o
 if [ $? -ne 0 ] ; then
   g.message -e "WFS-XML file not readable. Check if xerces-c support is compiled into GDAL/OGR library."
-  rm -f "$TMP.xml" "$TMP" "$TMP.gfs"
+  rm -f "$TEMPFILE.xml" "$TEMPFILE" "$TEMPFILE.gfs"
   exit 1
 fi
 
-rm -f "$TMP.xml" "$TMP" "$TMP.gfs"
+rm -f "$TEMPFILE.xml" "$TEMPFILE" "$TEMPFILE.gfs"
 
-v.support $OUT cmdhist="${CMDLINE}"
+v.support "$OUT" cmdhist="${CMDLINE}"
 g.message "Vector points map <$OUT> imported from WFS."
 
 exit 0

Modified: grass/branches/releasebranch_6_4/scripts/v.out.gpsbabel/v.out.gpsbabel
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.out.gpsbabel/v.out.gpsbabel	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/v.out.gpsbabel/v.out.gpsbabel	2010-03-07 22:07:48 UTC (rev 41340)
@@ -150,8 +150,8 @@
 
 
 #### set temporary files
-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
@@ -160,7 +160,7 @@
 cleanup()
 {
    g.message -v "Cleaning up ..."
-   \rm -f "$TMP" "$TMP.gpx"
+   \rm -f "$TEMPFILE" "$TEMPFILE.gpx"
    # only try to remove map if it exists to avoid ugly warnings
    g.findfile element=vector file="tmp_vogb_epsg4326_$$" > /dev/null
    if [ $? -eq 0 ] ; then
@@ -181,13 +181,13 @@
 
 if [ $WPT -eq 1 ] && ([ $RTE -eq 1 ] || [ $TRK -eq 1 ]) ; then
     g.message -e "One feature at a time please."
-    rm -f "${TMP}"
+    rm -f "$TEMPFILE"
     exit 1
 fi
 # logic eludes me at pressent..  [combine with above]
 if [ $RTE -eq 1 ] && [ $TRK -eq 1 ] ; then
     g.message -e "One feature at a time please."
-    rm -f "${TMP}"
+    rm -f "$TEMPFILE"
     exit 1
 fi
 
@@ -310,7 +310,7 @@
 
 g.message -v "Exporting data ..."
 
-v.out.ogr in="tmp_vogb_epsg4326_$$" dsn="$TMP.gpx" type="$GIS_OPT_TYPE" \
+v.out.ogr in="tmp_vogb_epsg4326_$$" dsn="$TEMPFILE.gpx" type="$GIS_OPT_TYPE" \
   format=GPX ${LINETYPE} dsco="GPX_USE_EXTENSIONS=YES" --quiet
 
 if [ $? -ne 0 ] ; then
@@ -321,7 +321,7 @@
 
 if [ "$GIS_OPT_FORMAT" = gpx ] ; then
    # short circuit, we have what we came for.
-   mv -f "$TMP.gpx" "$GIS_OPT_OUTPUT"
+   mv -f "$TEMPFILE.gpx" "$GIS_OPT_OUTPUT"
    cleanup
    g.message -v "Fast exit."
    exit 0
@@ -340,7 +340,7 @@
 
 g.message -v "Running GpsBabel ..."
 
-gpsbabel $GTYPE -i gpx -f "$TMP.gpx" \
+gpsbabel $GTYPE -i gpx -f "$TEMPFILE.gpx" \
     -o "$GIS_OPT_FORMAT" -F "$GIS_OPT_OUTPUT"
 
 if [ $? -ne 0 ] ; then

Modified: grass/branches/releasebranch_6_4/scripts/v.rast.stats/v.rast.stats
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.rast.stats/v.rast.stats	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/v.rast.stats/v.rast.stats	2010-03-07 22:07:48 UTC (rev 41340)
@@ -88,14 +88,14 @@
 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
-SQLTMP="$TMP.sql"
+SQLTMP="$TEMPFILE.sql"
 # we need a random name
-TMPNAME=`basename "$TMP"`
+TMPNAME=`basename "$TEMPFILE"`
 
 cleanup()
 {
@@ -108,7 +108,7 @@
       g.message "Restoring previous MASK..."
       g.rename "${TMPNAME}_origmask",MASK --quiet
    fi
-   rm -f "$TMP" "$TMPNAME" "$TMP.cats" "$SQLTMP"
+   rm -f "$TEMPFILE" "$TMPNAME" "$TEMPFILE.cats" "$SQLTMP"
 }
 
 # what to do in case of user break:
@@ -185,9 +185,9 @@
 
 
 #dump cats to file to avoid "too many argument" problem:
-r.category "${VECTOR}_${TMPNAME}" fs=';' --quiet | cut -d';' -f1 > "$TMP.cats"
+r.category "${VECTOR}_${TMPNAME}" fs=';' --quiet | cut -d';' -f1 > "$TEMPFILE.cats"
 #echo "List of categories found: $CATSLIST"
-NUMBER=`cat "$TMP.cats" | wc -l | awk '{print $1}'`
+NUMBER=`cat "$TEMPFILE.cats" | wc -l | awk '{print $1}'`
 if [ $NUMBER -lt 1 ] ; then
    g.message -e "No categories found in raster map"
    cleanup
@@ -285,7 +285,7 @@
    EXTSTAT=""
 fi
 
-for i in `cat "$TMP.cats"` ; do
+for i in `cat "$TEMPFILE.cats"` ; do
    g.message -v message="Processing category $i ($CURRNUM/$NUMBER)"
    g.remove MASK --quiet 2>/dev/null
    # r.mapcalc doesn't use the parser, so we set the env var version instead

Modified: grass/branches/releasebranch_6_4/scripts/v.univar.sh/v.univar.sh
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.univar.sh/v.univar.sh	2010-03-07 21:59:31 UTC (rev 41339)
+++ grass/branches/releasebranch_6_4/scripts/v.univar.sh/v.univar.sh	2010-03-07 22:07:48 UTC (rev 41340)
@@ -80,15 +80,15 @@
 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
 
 cleanup()
 {
-   \rm -f "$TMP" "$TMP.sort"
+   \rm -f "$TEMPFILE" "$TEMPFILE.sort"
 }
 
 # what to do in case of user break:
@@ -118,9 +118,9 @@
 fi
 
 if [ -z "$GIS_OPT_WHERE" ] ; then
-   db.select table="$GIS_OPT_TABLE" ${db} ${drv} sql="select $GIS_OPT_COLUMN from $GIS_OPT_TABLE" -c > "$TMP"
+   db.select table="$GIS_OPT_TABLE" ${db} ${drv} sql="select $GIS_OPT_COLUMN from $GIS_OPT_TABLE" -c > "$TEMPFILE"
 else
-   db.select table="$GIS_OPT_TABLE" ${db} ${drv} sql="select $GIS_OPT_COLUMN from $GIS_OPT_TABLE WHERE $GIS_OPT_WHERE" -c > "$TMP"
+   db.select table="$GIS_OPT_TABLE" ${db} ${drv} sql="select $GIS_OPT_COLUMN from $GIS_OPT_TABLE WHERE $GIS_OPT_WHERE" -c > "$TEMPFILE"
 fi
 
 
@@ -133,7 +133,7 @@
 #echo ""
 
 #check if map contains only NULL's in current region
-LINES=`wc -l "$TMP" | awk '{print $1}'`
+LINES=`wc -l "$TEMPFILE" | awk '{print $1}'`
 if [ "$LINES" -eq 0 ] ; then
  g.message -e "Table $GIS_OPT_TABLE contains no data." 
  cleanup
@@ -142,7 +142,7 @@
 
 # calculate statistics
 g.message "Calculating statistics..."
-cat "$TMP" | awk 'BEGIN {sum = 0.0 ; sum2 = 0.0; min = 10e10 ; max = -min}
+cat "$TEMPFILE" | awk 'BEGIN {sum = 0.0 ; sum2 = 0.0; min = 10e10 ; max = -min}
 function abs(x){return x < 0 ? -x : x}
 (NF>0) {
 	sum += $1 ; sum2 += $1 * $1 ; sum3 += abs($1) ; N++;
@@ -170,14 +170,14 @@
 
 if [ $GIS_FLAG_E -eq 1 ] ; then
   #preparations:
-  cat "$TMP" | sort -n > "$TMP.sort"
-  NUMBER=`cat "$TMP.sort" | wc -l | awk '{print $1}'`
+  cat "$TEMPFILE" | sort -n > "$TEMPFILE.sort"
+  NUMBER=`cat "$TEMPFILE.sort" | wc -l | awk '{print $1}'`
   ODDEVEN=`echo "$NUMBER" | awk '{print $1%2}'`
 
   # 0.25 quartile
   QUARTILE=0.25
   QPOS=`echo $NUMBER $QUARTILE | awk '{printf "%d", $1 * $2 + 0.5}'`
-  QELEMENT=`head -n $QPOS "$TMP.sort" | tail -n 1`
+  QELEMENT=`head -n $QPOS "$TEMPFILE.sort" | tail -n 1`
   echo "1st Quartile: $QELEMENT"
 
   #Calculate median
@@ -187,13 +187,13 @@
    EVENMEDIANNUMBER=`expr $NUMBER / 2`
    EVENMEDIANNUMBERPLUSONE=`expr $EVENMEDIANNUMBER + 1`
    # select two numbers
-   SELECTEDNUMBERS=`cat "$TMP.sort" | head -n $EVENMEDIANNUMBERPLUSONE | tail -n 2`
+   SELECTEDNUMBERS=`cat "$TEMPFILE.sort" | head -n $EVENMEDIANNUMBERPLUSONE | tail -n 2`
    RESULTEVENMEDIAN=`echo $SELECTEDNUMBERS | awk '{printf "%f", ($1 + $2)/2.0}'`
    echo "Median (even N): $RESULTEVENMEDIAN"
   else
    # odd
    ODDMEDIANNUMBER=`echo $NUMBER | awk '{printf "%d", int($1/2+.5)}'`
-   RESULTODDMEDIAN=`cat "$TMP.sort" | head -n $ODDMEDIANNUMBER | tail -n 1 | awk '{printf "%f", $1}'`
+   RESULTODDMEDIAN=`cat "$TEMPFILE.sort" | head -n $ODDMEDIANNUMBER | tail -n 1 | awk '{printf "%f", $1}'`
    echo "Median (odd N): $RESULTODDMEDIAN"
   fi
 
@@ -201,13 +201,13 @@
   # 0.75 quartile
   QUARTILE=0.75
   QPOS=`echo $NUMBER $QUARTILE | awk '{printf "%d", $1 * $2 + 0.5}'`
-  QELEMENT=`head -n $QPOS "$TMP.sort" | tail -n 1`
+  QELEMENT=`head -n $QPOS "$TEMPFILE.sort" | tail -n 1`
   echo "3rd Quartile: $QELEMENT"
 
   # 0.90 percentile
   QUARTILE=0.9
   QPOS=`echo $NUMBER $QUARTILE | awk '{printf "%d", $1 * $2 + 0.5}'`
-  QELEMENT=`head -n $QPOS "$TMP.sort" | tail -n 1`
+  QELEMENT=`head -n $QPOS "$TEMPFILE.sort" | tail -n 1`
   echo "90th Percentile: $QELEMENT"
 
 fi



More information about the grass-commit mailing list