[GRASS5] Re: [bug #3277] (grass) d.vect.thematic fails with
DOUBLE
Hamish
hamish_nospam at yahoo.com
Tue May 31 20:58:07 EDT 2005
> My first "solution" really shouldn't work like you said Daniel and
> worked only in this particular case.
>
> I think I understood the problem (for real this time) and resolved it.
>
> I have two DOUBLE PRECISSION columns, one is called PROD, the other
> POPROD.
>
> Hamish's solution ... | grep ^"$GIS_OPT_column"$ | ... couldn't handle
> that due to "|" between the column type and column name printed by
> "v.info -c", e.g. DOUBLE PRECISION|PROD.
right. I was getting confused with the output of db.columns.
> In this situation we need either
>
> ... | grep "|"$GIS_OPT_column$ | ...
>
> or
>
> ... | grep -w $GIS_OPT_column | ...
>
> Both work. Which one is better? "grep -w" seems cleaner.
I agree.
> One thing more: there should be another error check for "no such
> column" prior to "# check column type". Let me suggest:
>
> ---
> # check if the column exists
> COLCHECK="`v.info -c $GIS_OPT_map layer=1 2> /dev/null | grep -w
> $GIS_OPT_column
>
> if [ "$COLCHECK" = "$GIS_OPT_column" ]; then
> echo ""
> else
> echo "ERROR: No such column \""$GIS_OPT_column"\""
> exit 1
> fi
> ---
>
> What do you think?
why not just:
COLTYPE=...
if [ -z "$COLTYPE" ] ; then
echo "ERROR: No such column [$GIS_OPT_column]"
exit 1
fi
Hamish
More information about the grass-dev
mailing list