[GRASS-SVN] r30548 - in grass/trunk/scripts: d.polar
d.vect.thematic db.dropcol db.in.ogr r.univar.sh v.db.dropcol
v.db.univar v.in.e00 v.in.mapgen v.univar.sh
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Mar 13 04:57:27 EDT 2008
Author: hamish
Date: 2008-03-13 04:57:26 -0400 (Thu, 13 Mar 2008)
New Revision: 30548
Modified:
grass/trunk/scripts/d.polar/d.polar
grass/trunk/scripts/d.vect.thematic/d.vect.thematic
grass/trunk/scripts/db.dropcol/db.dropcol
grass/trunk/scripts/db.in.ogr/db.in.ogr
grass/trunk/scripts/r.univar.sh/r.univar.sh
grass/trunk/scripts/v.db.dropcol/v.db.dropcol
grass/trunk/scripts/v.db.univar/v.db.univar
grass/trunk/scripts/v.in.e00/v.in.e00
grass/trunk/scripts/v.in.mapgen/v.in.mapgen
grass/trunk/scripts/v.univar.sh/v.univar.sh
Log:
quote some filename variables
Modified: grass/trunk/scripts/d.polar/d.polar
===================================================================
--- grass/trunk/scripts/d.polar/d.polar 2008-03-13 08:01:14 UTC (rev 30547)
+++ grass/trunk/scripts/d.polar/d.polar 2008-03-13 08:57:26 UTC (rev 30548)
@@ -116,23 +116,23 @@
#################################
# 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" > "${TMP}_raw"
+TOTALNUMBER=`wc -l "${TMP}_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 "${TMP}_raw" | grep -v '^\*$' | grep -v "^${GIS_OPT_UNDEF}$" | \
+ awk '{printf "%d\n", int($1 + .5)}' | sed 's+^360+0+g' > "${TMP}_binned"
# make radians
-cat ${TMP}_binned | awk '{printf "%f\n", (3.14159265 * $1 ) / 180.}' > ${TMP}_binned_radians
+cat "${TMP}_binned" | awk '{printf "%f\n", (3.14159265 * $1 ) / 180.}' > "${TMP}_binned_radians"
#################################
# generate numbers for max circle
-TOTALVALIDNUMBER=`wc -l ${TMP}_binned_radians | awk '{print $1}'`
+TOTALVALIDNUMBER=`wc -l "${TMP}_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 "${TMP}_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}' > "${TMP}_cos_sums"
-cat ${TMP}_raw | grep -v '^\*' | grep -v "^${GIS_OPT_UNDEF}$" | awk 'BEGIN {sum = 0.0}
+cat "${TMP}_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}' > "${TMP}_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 "${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"`
#################################
# how many are there?:
-wordcount ${TMP}_binned_radians | sort -n -t ' ' -k 1 > ${TMP}_occurencies
+wordcount "${TMP}_binned_radians" | sort -n -t ' ' -k 1 > "${TMP}_occurrences"
# find the maximum value
-MAXRADIUS="`cat ${TMP}_occurencies | sort -n -t ' ' -k 2 | tail -n 1 | cut -d' ' -f2`"
+MAXRADIUS="`cat "${TMP}_occurrences" | sort -n -t ' ' -k 2 | tail -n 1 | cut -d' ' -f2`"
# now do cos() sin()
-cat ${TMP}_occurencies | awk '{printf "%f %f\n", cos($1) * $2 , sin($1) *$2}' > ${TMP}_sine_cosine
+cat "${TMP}_occurrences" | awk '{printf "%f %f\n", cos($1) * $2 , sin($1) *$2}' > "${TMP}_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 "${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"
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
+ echo "\"All Data incl. NULLs" > "${TMP}_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
+ }' >> "${TMP}_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" > "${TMP}_vector"
+echo "0 0" >> "${TMP}_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}' >> "${TMP}_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 "" > "${TMP}_newline"
+cat "${TMP}_sine_cosine_replic" "${TMP}_newline" "${TMP}_outercircle" \
+ "${TMP}_newline" "${TMP}_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 "${TMP}_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
+ > "${TMP}_sine_cosine_replic_normalized"
# create circle
awk -v RING=$RING -v PI=$PI 'BEGIN {
@@ -272,10 +272,10 @@
printf("%f %f\n", 50*(1+(RING * sin(i * (PI/180)))),
50*(1+(RING * cos(i * (PI/180)))) )
}
- }' > ${TMP}_circle
+ }' > "${TMP}_circle"
# trend vector
-VECT=`cat ${TMP}_vector | tail -n 1 | awk -v SCL=$SCALEVAL -v MAX=$MAXRADIUS \
+VECT=`cat "${TMP}_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}'`
@@ -296,7 +296,7 @@
# mandatory when drawing proportional to non-square frame
color 180:255:180
polyline
- `cat ${TMP}_circle`
+ `cat "${TMP}_circle"`
# draw axes
color 180:180:180
@@ -310,7 +310,7 @@
color red
width 0
polyline
- `cat ${TMP}_sine_cosine_replic_normalized`
+ `cat "${TMP}_sine_cosine_replic_normalized"`
# draw vector
color blue
@@ -405,7 +405,7 @@
AVERAGEDIRECTIONLEGENDY=`echo "1.85 $HALFFRAME" | awk '{printf "%.1f", $1 * $2}'`
##########
-cat ${GISBASE}/etc/d.polar/ps_defs.eps > $PSOUT
+cat ${GISBASE}/etc/d.polar/ps_defs.eps > "$PSOUT"
echo "
$EPSSCALE $EPSSCALE scale %% EPS-SCALE EPS-SCALE scale
@@ -434,15 +434,15 @@
newpath
%% coordinates of rescaled, translated outer circle follow
%% first point moveto, then lineto
-" >> $PSOUT
+" >> "$PSOUT"
-SUBLENGTH=`wc -l ${TMP}_outercircle | awk '{printf "%d", $1 - 2}'`
-LINE1=`head -n 2 ${TMP}_outercircle | tail -n 1`
-echo $LINE1 $SCALE $HALFFRAME | awk '{printf "%.2f %.2f moveto\n", $1*$3+$4, $2*$3+$4}' >> $PSOUT
+SUBLENGTH=`wc -l "${TMP}_outercircle" | awk '{printf "%d", $1 - 2}'`
+LINE1=`head -n 2 "${TMP}_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 "${TMP}_outercircle" | sed "s+\$+ $SCALE $HALFFRAME+g" > "${TMP}_outercircle_lineto"
-cat ${TMP}_outercircle_lineto | awk '{printf "%.2f %.2f lineto\n",$1*$3+$4, $2*$3+$4 }' >> $PSOUT
+cat "${TMP}_outercircle_lineto" | awk '{printf "%.2f %.2f lineto\n",$1*$3+$4, $2*$3+$4 }' >> "$PSOUT"
rm -f "${TMP}_outercircle_lineto"
echo "stroke
@@ -470,15 +470,18 @@
newpath
%% coordinates of rescaled, translated diagram follow
%% first point moveto, then lineto
-" >> $PSOUT
+" >> "$PSOUT"
-SUBLENGTH=`wc -l ${TMP}_sine_cosine_replic | awk '{printf "%d", $1 - 2}'`
-LINE1=`head -n 2 ${TMP}_sine_cosine_replic | tail -n 1`
-echo $LINE1 $SCALE $HALFFRAME | awk '{printf "%.2f %.2f moveto\n", $1*$3+$4, $2*$3+$4}' >> $PSOUT
+SUBLENGTH=`wc -l "${TMP}_sine_cosine_replic" | awk '{printf "%d", $1 - 2}'`
+LINE1=`head -n 2 "${TMP}_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 "${TMP}_sine_cosine_replic" | \
+ sed "s+\$+ $SCALE $HALFFRAME+g" > "${TMP}_sine_cosine_replic_lineto"
-cat ${TMP}_sine_cosine_replic_lineto | awk '{printf "%.2f %.2f lineto\n",$1*$3+$4, $2*$3+$4 }' >> $PSOUT
+cat "${TMP}_sine_cosine_replic_lineto" | \
+ awk '{printf "%.2f %.2f lineto\n",$1*$3+$4, $2*$3+$4 }' >> "$PSOUT"
+
rm -f "${TMP}_sine_cosine_replic_lineto"
echo "stroke
@@ -494,13 +497,13 @@
%% 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`
-echo $LINE1 $SCALE $HALFFRAME | awk '{printf "%.2f %.2f moveto\n", $1*$3+$4, $2*$3+$4}' >> $PSOUT
+SUBLENGTH=`wc -l "${TMP}_vector" | awk '{printf "%d", $1 - 2}'`
+LINE1=`head -n 2 "${TMP}_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 "${TMP}_vector" | sed "s+\$+ $SCALE $HALFFRAME+g" > "${TMP}_vector_lineto"
-cat ${TMP}_vector_lineto | awk '{printf "%.2f %.2f lineto\n",$1*$3+$4, $2*$3+$4 }' >> $PSOUT
+cat "${TMP}_vector_lineto" | awk '{printf "%.2f %.2f lineto\n",$1*$3+$4, $2*$3+$4 }' >> "$PSOUT"
rm -f "${TMP}_vector_lineto"
echo "stroke
@@ -520,7 +523,7 @@
col1 %% colAVERAGE-DIRECTION-COLOR
%% Line below: (AVERAGE-DIRECTION-STRING) LEGENDS-X AVERAGE-DIRECTION-LEGEND-Y 4 just-string
($AVERAGEDIRECTIONSTRING) $LEGENDSX $AVERAGEDIRECTIONLEGENDY 4 just-string
-" >> $PSOUT
+" >> "$PSOUT"
g.message "Done."
}
Modified: grass/trunk/scripts/d.vect.thematic/d.vect.thematic
===================================================================
--- grass/trunk/scripts/d.vect.thematic/d.vect.thematic 2008-03-13 08:01:14 UTC (rev 30547)
+++ grass/trunk/scripts/d.vect.thematic/d.vect.thematic 2008-03-13 08:57:26 UTC (rev 30548)
@@ -394,15 +394,15 @@
fi
fi
-min="`grep 'min=' $TMP1 | sed s/min=//`"
-max="`grep 'max=' $TMP1 | sed s/max=//`"
-mean="`grep 'mean=' $TMP1 | sed s/mean=//`"
-sd="`grep 'population_stddev=' $TMP1 | sed s/'population_stddev='//`"
-q1="`grep 'first_quartile=' $TMP1 | sed s/'first_quartile='//`"
-q2="`grep 'median=' $TMP1 | sed s/'median='//`"
-q3="`grep 'third_quartile=' $TMP1 | sed s/'third_quartile='//`"
-q4=$max
-ptsize=$GIS_OPT_SIZE
+min=`grep 'min=' "$TMP1" | sed s/min=//`
+max=`grep 'max=' "$TMP1" | sed s/max=//`
+mean=`grep 'mean=' "$TMP1" | sed s/mean=//`
+sd=`grep 'population_stddev=' "$TMP1" | sed s/'population_stddev='//`
+q1=`grep 'first_quartile=' "$TMP1" | sed s/'first_quartile='//`
+q2=`grep 'median=' "$TMP1" | sed s/'median='//`
+q3=`grep 'third_quartile=' "$TMP1" | sed s/'third_quartile='//`
+q4="$max"
+ptsize="$GIS_OPT_SIZE"
if [ -n "$GIS_OPT_BREAKPOINTS" ] && [ "$GIS_OPT_THEMECALC" != "custom_breaks" ] ; then
g.message -w "Custom breakpoints ignored due to themecalc setting."
@@ -471,11 +471,11 @@
echo "title - - - {Thematic map legend for column $GIS_OPT_COLUMN of map $GIS_OPT_MAP}" > "$TMP6"
echo "text 1% 95% Thematic map legend for column $GIS_OPT_COLUMN of map $GIS_OPT_MAP" >> "$TMP5"
-echo " ref bottom left" >> $TMP5
-echo "end" >> $TMP5
+echo " ref bottom left" >> "$TMP5"
+echo "end" >> "$TMP5"
echo "text 4% 90% Value range: $min - $max" >> "$TMP5"
-echo " ref bottom left" >> $TMP5
-echo "end" >> $TMP5
+echo " ref bottom left" >> "$TMP5"
+echo "end" >> "$TMP5"
g.message message="Thematic map legend for column $GIS_OPT_COLUMN of map $GIS_OPT_MAP"
g.message message="Value range: $min - $max"
@@ -558,8 +558,8 @@
echo "subtitle - - - {Mapped by $numint intervals of $step}" >> "$TMP6"
echo "text 4% 87% Mapped by $numint intervals of $step" >> "$TMP5"
- echo " ref bottom left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref bottom left" >> "$TMP5"
+ echo "end" >> "$TMP5"
g.message message="Mapped by $numint intervals of $step"
fi
@@ -573,8 +573,8 @@
echo "subtitle - - - {Mapped by standard deviation units of $sd (mean =$mean)}" >> "$TMP6"
echo "text 4% 87% Mapped by standard deviation units of $sd (mean =$mean)" >> "$TMP5"
- echo " ref bottom left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref bottom left" >> "$TMP5"
+ echo "end" >> "$TMP5"
g.message message="Mapped by standard deviation units of $sd (mean =$mean)"
fi
@@ -588,8 +588,8 @@
echo "subtitle - - - {Mapped by quartiles (median =$q2)}" >> "$TMP6"
echo "text 4% 87% Mapped by quartiles (median =$q2)" >> "$TMP5"
- echo " ref bottom left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref bottom left" >> "$TMP5"
+ echo "end" >> "$TMP5"
@@ -607,17 +607,17 @@
echo "text 4% 83% Color" >> "$TMP5"
- echo " ref bottom left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref bottom left" >> "$TMP5"
+ echo "end" >> "$TMP5"
echo "text 14% 83% Value" >> "$TMP5"
- echo " ref bottom left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref bottom left" >> "$TMP5"
+ echo "end" >> "$TMP5"
echo "text 4% 80% =====" >> "$TMP5"
- echo " ref bottom left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref bottom left" >> "$TMP5"
+ echo "end" >> "$TMP5"
echo "text 14% 80% ============" >> "$TMP5"
- echo " ref bottom left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref bottom left" >> "$TMP5"
+ echo "end" >> "$TMP5"
echo "Color(R:G:B)" "Value" | awk '{print $1 "\t" $2}'
@@ -695,7 +695,7 @@
echo "text $openbracket$rangemin - $rangemax$closebracket $extranote" >> "$TMP2"
else
if [ $i -eq $xlower ]; then
- echo "color 0:0:0" >>"$TMP2"
+ echo "color 0:0:0" >> "$TMP2"
echo "move 10 $line2" >> "$TMP2"
echo "text ..." >> "$TMP2"
else
@@ -708,12 +708,12 @@
echo "area $themecolor $linecolor - {$openbracket$rangemin - $rangemax$closebracket $extranote}" >> "$TMP6"
if [ "$GIS_OPT_TYPE" = "line" -o "$GIS_OPT_TYPE" = "boundary" ] ; then
- echo "line 5% $xline1% 8% $xline1%" >> $TMP5
- echo " color $linecolor" >> $TMP5
- echo "end" >> $TMP5
+ echo "line 5% $xline1% 8% $xline1%" >> "$TMP5"
+ echo " color $linecolor" >> "$TMP5"
+ echo "end" >> "$TMP5"
echo "text 14% $xline1% $openbracket$rangemin - $rangemax$closebracket $extranote" >> "$TMP5"
- echo " ref center left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref center left" >> "$TMP5"
+ echo "end" >> "$TMP5"
elif [ "$GIS_OPT_TYPE" = "point" -o "$GIS_OPT_TYPE" = "centroid" ] ; then
echo "point 8% $xline1%" >> "$TMP5"
echo " color $linecolor" >> "$TMP5"
@@ -722,23 +722,23 @@
echo " symbol $GIS_OPT_ICON" >> "$TMP5"
echo "end" >> "$TMP5"
echo "text 14% $xline1% $openbracket$rangemin - $rangemax$closebracket $extranote" >> "$TMP5"
- echo " ref center left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref center left" >> "$TMP5"
+ echo "end" >> "$TMP5"
else
echo "rectangle 5% $xline1% 8% $xline3%" >> "$TMP5"
echo " color 0:0:0" >> "$TMP5"
echo " fcolor $themecolor" >> "$TMP5"
echo "end" >> "$TMP5"
echo "text 14% $xline3% $openbracket$rangemin - $rangemax$closebracket DCADCA $extranote" >> "$TMP5"
- echo " ref bottom left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref bottom left" >> "$TMP5"
+ echo "end" >> "$TMP5"
fi
else
if [ $i -eq $xlower ]; then
echo "color 0:0:0" >>"$TMP5"
echo "text 14% $xline3% ..." >> "$TMP5"
- echo " ref bottom left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref bottom left" >> "$TMP5"
+ echo "end" >> "$TMP5"
echo "text - - - {...}" >> "$TMP6"
fi
@@ -821,31 +821,31 @@
color=$linecolor fcolor=$themecolor icon=$GIS_OPT_ICON size=$ptsize
if [ "$GIS_OPT_TYPE" = "line" -o "$GIS_OPT_TYPE" = "boundary" ] ; then
- echo "vlines $GIS_OPT_MAP" >> $TMP4
- echo " type $GIS_OPT_TYPE" >> $TMP4
- echo " layer $GIS_OPT_LAYER" >> $TMP4
- echo " where $sqlwhere" >> $TMP4
- echo " color $linecolor" >> $TMP4
- echo " label $rangemin - $rangemax" >> $TMP4
- echo "end" >> $TMP4
+ echo "vlines $GIS_OPT_MAP" >> "$TMP4"
+ echo " type $GIS_OPT_TYPE" >> "$TMP4"
+ echo " layer $GIS_OPT_LAYER" >> "$TMP4"
+ echo " where $sqlwhere" >> "$TMP4"
+ echo " color $linecolor" >> "$TMP4"
+ echo " label $rangemin - $rangemax" >> "$TMP4"
+ echo "end" >> "$TMP4"
elif [ "$GIS_OPT_TYPE" = "point" -o "$GIS_OPT_TYPE" = "centroid" ] ; then
- echo "vpoints $GIS_OPT_MAP" >> $TMP4
- echo " type $GIS_OPT_TYPE" >> $TMP4
- echo " layer $GIS_OPT_LAYER" >> $TMP4
- echo " where $sqlwhere" >> $TMP4
- echo " color $linecolor" >> $TMP4
- echo " fcolor $themecolor" >> $TMP4
- echo " symbol $GIS_OPT_ICON" >> $TMP4
- echo " label $rangemin - $rangemax" >> $TMP4
- echo "end" >> $TMP4
+ echo "vpoints $GIS_OPT_MAP" >> "$TMP4"
+ echo " type $GIS_OPT_TYPE" >> "$TMP4"
+ echo " layer $GIS_OPT_LAYER" >> "$TMP4"
+ echo " where $sqlwhere" >> "$TMP4"
+ echo " color $linecolor" >> "$TMP4"
+ echo " fcolor $themecolor" >> "$TMP4"
+ echo " symbol $GIS_OPT_ICON" >> "$TMP4"
+ echo " label $rangemin - $rangemax" >> "$TMP4"
+ echo "end" >> "$TMP4"
else
- echo "vareas $GIS_OPT_MAP" >> $TMP4
- echo " layer $GIS_OPT_LAYER" >> $TMP4
- echo " where $sqlwhere" >> $TMP4
- echo " color $linecolor" >> $TMP4
- echo " fcolor $themecolor" >> $TMP4
- echo " label $rangemin - $rangemax" >> $TMP4
- echo "end" >> $TMP4
+ echo "vareas $GIS_OPT_MAP" >> "$TMP4"
+ echo " layer $GIS_OPT_LAYER" >> "$TMP4"
+ echo " where $sqlwhere" >> "$TMP4"
+ echo " color $linecolor" >> "$TMP4"
+ echo " fcolor $themecolor" >> "$TMP4"
+ echo " label $rangemin - $rangemax" >> "$TMP4"
+ echo "end" >> "$TMP4"
fi
@@ -879,8 +879,8 @@
echo "subtitle - - - {Mapped by $numint intervals of $step}" >> "$TMP6"
echo "text 4% 87% Mapped by $numint intervals of $step" >> "$TMP5"
- echo " ref bottom left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref bottom left" >> "$TMP5"
+ echo "end" >> "$TMP5"
g.message message="Mapped by $numint intervals of $step"
fi
@@ -894,8 +894,8 @@
echo "subtitle - - - {Mapped by standard deviation units of $sd (mean =$mean)}" >> "$TMP6"
echo "text 4% 87% Mapped by standard deviation units of $sd (mean =$mean)" >> "$TMP5"
- echo " ref bottom left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref bottom left" >> "$TMP5"
+ echo "end" >> "$TMP5"
g.message message="Mapped by standard deviation units of $sd (mean =$mean)"
fi
@@ -909,8 +909,8 @@
echo "subtitle - - - {Mapped by quartiles (median =$q2)}" >> "$TMP6"
echo "text 4% 87% Mapped by quartiles (median =$q2)" >> "$TMP5"
- echo " ref bottom left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref bottom left" >> "$TMP5"
+ echo "end" >> "$TMP5"
g.message message="Mapped by quartiles (median = $q2)"
fi
@@ -928,17 +928,17 @@
echo "text 4% 83% Icon size" >> "$TMP5"
- echo " ref bottom left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref bottom left" >> "$TMP5"
+ echo "end" >> "$TMP5"
echo "text 25% 83% Value" >> "$TMP5"
- echo " ref bottom left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref bottom left" >> "$TMP5"
+ echo "end" >> "$TMP5"
echo "text 4% 80% ============" >> "$TMP5"
- echo " ref bottom left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref bottom left" >> "$TMP5"
+ echo "end" >> "$TMP5"
echo "text 25% 80% ============" >> "$TMP5"
- echo " ref bottom left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref bottom left" >> "$TMP5"
+ echo "end" >> "$TMP5"
echo "Size/width" "Value" | awk '{print $1 " " $2"\t"$3}'
@@ -1036,8 +1036,8 @@
echo " symbol $GIS_OPT_ICON" >> "$TMP5"
echo "end" >> "$TMP5"
echo "text 25% $line1% $openbracket$rangemin - $rangemax$closebracket $extranote" >> "$TMP5"
- echo " ref center left" >> $TMP5
- echo "end" >> $TMP5
+ echo " ref center left" >> "$TMP5"
+ echo "end" >> "$TMP5"
else
if [ $i -eq $xlower ]; then
echo "text 25% $xline1% ..." >> "$TMP5"
@@ -1121,16 +1121,16 @@
color=$linecolor fcolor=$themecolor icon=$GIS_OPT_ICON size=$ptsize
fi
- echo "vpoints $GIS_OPT_MAP" >> $TMP4
- echo " type $GIS_OPT_TYPE" >> $TMP4
- echo " layer $GIS_OPT_LAYER" >> $TMP4
- echo " where $sqlwhere" >> $TMP4
- echo " color $linecolor" >> $TMP4
- echo " fcolor $themecolor" >> $TMP4
- echo " symbol $GIS_OPT_ICON" >> $TMP4
- echo " size $ptsize" >> $TMP4
- echo " label $rangemin - $rangemax" >> $TMP4
- echo "end" >> $TMP4
+ echo "vpoints $GIS_OPT_MAP" >> "$TMP4"
+ echo " type $GIS_OPT_TYPE" >> "$TMP4"
+ echo " layer $GIS_OPT_LAYER" >> "$TMP4"
+ echo " where $sqlwhere" >> "$TMP4"
+ echo " color $linecolor" >> "$TMP4"
+ echo " fcolor $themecolor" >> "$TMP4"
+ echo " symbol $GIS_OPT_ICON" >> "$TMP4"
+ echo " size $ptsize" >> "$TMP4"
+ echo " label $rangemin - $rangemax" >> "$TMP4"
+ echo "end" >> "$TMP4"
ptsize=`echo $ptsize $pointstep | awk '{print $1 - $2}'`
@@ -1158,7 +1158,7 @@
d.mon select=$GIS_OPT_MONITOR > /dev/null
d.erase
fi
- d.graph input=$TMP2
+ d.graph input="$TMP2"
if [ -n "$currmon" ] ; then
d.mon select=$currmon
fi
@@ -1167,27 +1167,27 @@
# Create group file for GIS Manager
echo "End" >> "$TMP3"
if [ "$GIS_FLAG_G" -eq 1 ] ; then
- cat $TMP3 > $group".dm"
+ cat "$TMP3" > "${group}.dm"
fi
# Create ps.map map file
echo "end" >> "$TMP4"
if [ "$GIS_OPT_PSMAP" ] ; then
- cat $TMP4 > $GIS_OPT_PSMAP.psmap
+ cat "$TMP4" > "$GIS_OPT_PSMAP.psmap"
fi
# Create ps.map legend file
echo "end" >> "$TMP5"
if [ "$GIS_OPT_PSMAP" ] ; then
- cat $TMP5 > $GIS_OPT_PSMAP\_legend.psmap
+ cat "$TMP5" > "$GIS_OPT_PSMAP\_legend.psmap"
fi
# Create text file to use with d.graph in GIS Manager
if [ "$GIS_FLAG_S" -eq 1 ] ; then
- tmpdir=`eval dirname $TMP6`
+ tmpdir=`eval dirname "$TMP6"`
tlegfile="$tmpdir/gismlegend.txt"
# echo $tlegfile > outtxt.txt
- cp $TMP6 $tlegfile
+ cp "$TMP6" "$tlegfile"
fi
cleanup
Modified: grass/trunk/scripts/db.dropcol/db.dropcol
===================================================================
--- grass/trunk/scripts/db.dropcol/db.dropcol 2008-03-13 08:01:14 UTC (rev 30547)
+++ grass/trunk/scripts/db.dropcol/db.dropcol 2008-03-13 08:57:26 UTC (rev 30548)
@@ -131,11 +131,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}:" > "$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'`
echo "BEGIN TRANSACTION;
CREATE TEMPORARY TABLE ${table}_backup(${COLDEF});
INSERT INTO ${table}_backup SELECT ${COLNAMES} FROM ${table};
@@ -143,8 +143,8 @@
CREATE TABLE ${table}(${COLDEF});
INSERT INTO ${table} SELECT ${COLNAMES} FROM ${table}_backup;
DROP TABLE ${table}_backup;
-COMMIT;" > $TMP
- db.execute input=$TMP
+COMMIT;" > "$TMP"
+ db.execute input="$TMP"
if [ $? -eq 1 ] ; then
g.message -e "Cannot continue (problem deleting column)."
cleanup
Modified: grass/trunk/scripts/db.in.ogr/db.in.ogr
===================================================================
--- grass/trunk/scripts/db.in.ogr/db.in.ogr 2008-03-13 08:01:14 UTC (rev 30547)
+++ grass/trunk/scripts/db.in.ogr/db.in.ogr 2008-03-13 08:57:26 UTC (rev 30548)
@@ -89,8 +89,8 @@
if [ -z "$GIS_OPT_OUTPUT" ] ; then
# file name laundery
- TMPNAME="`echo $INPUT | tr -s '.' '_'`"
- GIS_OPT_OUTPUT="`basename $TMPNAME`"
+ TMPNAME=`echo "$INPUT" | tr -s '.' '_'`
+ GIS_OPT_OUTPUT=`basename "$TMPNAME"`
fi
if [ -z "$GRASS_OVERWRITE" ] ; then
Modified: grass/trunk/scripts/r.univar.sh/r.univar.sh
===================================================================
--- grass/trunk/scripts/r.univar.sh/r.univar.sh 2008-03-13 08:01:14 UTC (rev 30547)
+++ grass/trunk/scripts/r.univar.sh/r.univar.sh 2008-03-13 08:57:26 UTC (rev 30548)
@@ -101,7 +101,7 @@
# calculate statistics
g.message "Calculating statistics..."
-cat $TMP | awk 'BEGIN {sum = 0.0 ; sum2 = 0.0}
+cat "$TMP" | 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 "$TMP" | sort -n > "$TMP.sort"
+ NUMBER=`cat "$TMP.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 "$TMP.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 "$TMP.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 "$TMP.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 "$TMP.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 "$TMP.sort" | tail -1`
echo "${GIS_OPT_PERCENTILE} Percentile: $QELEMENT"
fi
Modified: grass/trunk/scripts/v.db.dropcol/v.db.dropcol
===================================================================
--- grass/trunk/scripts/v.db.dropcol/v.db.dropcol 2008-03-13 08:01:14 UTC (rev 30547)
+++ grass/trunk/scripts/v.db.dropcol/v.db.dropcol 2008-03-13 08:57:26 UTC (rev 30548)
@@ -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=$table | cut -d'|' -f1,2 | grep -v "|${col}$" > $TMP.coldesc
+ v.info --q -c map=$table | cut -d'|' -f1,2 | grep -v "|${col}$" > "$TMP.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 "$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'`
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;" > "$TMP"
+ db.execute input="$TMP"
if [ $? -eq 1 ] ; then
g.message -e 'Cannot continue (problem deleting column)'
cleanup
Modified: grass/trunk/scripts/v.db.univar/v.db.univar
===================================================================
--- grass/trunk/scripts/v.db.univar/v.db.univar 2008-03-13 08:01:14 UTC (rev 30547)
+++ grass/trunk/scripts/v.db.univar/v.db.univar 2008-03-13 08:57:26 UTC (rev 30548)
@@ -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 "$TMP" | 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 "$TMP" | sort -n > "$TMP.sort"
+ NUMBER=`cat "$TMP.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 "$TMP.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 "$TMP.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 "$TMP.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 "$TMP.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 "$TMP.sort" | tail -n 1`
echo "90th Percentile: $QELEMENT"
fi
Modified: grass/trunk/scripts/v.in.e00/v.in.e00
===================================================================
--- grass/trunk/scripts/v.in.e00/v.in.e00 2008-03-13 08:01:14 UTC (rev 30547)
+++ grass/trunk/scripts/v.in.e00/v.in.e00 2008-03-13 08:57:26 UTC (rev 30548)
@@ -165,11 +165,11 @@
if [ $MERGING -eq 1 ] ; then
if [ "$EXTENSION" = "CAPS" ] ; then
- cat `ls -1 $E00NAME.E* | sort` > $E00NAME.cat.$E00TMP.e00
+ cat `ls -1 "$E00NAME.E"* | sort` > "$E00NAME.cat.$E00TMP.e00"
GIS_OPT_FILE="$E00NAME.cat.$E00TMP.e00"
fi
if [ "$EXTENSION" = "NOCAPS" ] ; then
- cat `ls -1 $E00NAME.e* | sort` > $E00NAME.cat.$E00TMP.e00
+ cat `ls -1 "$E00NAME.e"* | sort` > "$E00NAME.cat.$E00TMP.e00"
GIS_OPT_FILE="$E00NAME.cat.$E00TMP.e00"
fi
fi
Modified: grass/trunk/scripts/v.in.mapgen/v.in.mapgen
===================================================================
--- grass/trunk/scripts/v.in.mapgen/v.in.mapgen 2008-03-13 08:01:14 UTC (rev 30547)
+++ grass/trunk/scripts/v.in.mapgen/v.in.mapgen 2008-03-13 08:57:26 UTC (rev 30548)
@@ -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 > "$TMP"
## matlab format. Cleanse with NaN->nan and spaces to tabs
tac "$FILE" | awk '{print $1 "\t" $2 "\t" $3}
Modified: grass/trunk/scripts/v.univar.sh/v.univar.sh
===================================================================
--- grass/trunk/scripts/v.univar.sh/v.univar.sh 2008-03-13 08:01:14 UTC (rev 30547)
+++ grass/trunk/scripts/v.univar.sh/v.univar.sh 2008-03-13 08:57:26 UTC (rev 30548)
@@ -170,14 +170,14 @@
if [ $GIS_FLAG_E -eq 1 ] ; then
#preparations:
- cat "$TMP" | sort -n > $TMP.sort
+ cat "$TMP" | sort -n > "$TMP.sort"
NUMBER=`cat "$TMP.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 "$TMP.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 "$TMP.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 "$TMP.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 "$TMP.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 "$TMP.sort" | tail -n 1`
echo "90th Percentile: $QELEMENT"
fi
More information about the grass-commit
mailing list