[GRASS-dev] Re: [GRASS-user] bug in v.db.renamecol

Markus Neteler neteler at osgeo.org
Fri Feb 8 01:01:28 EST 2008


On Feb 8, 2008 12:06 AM, Hamish <hamish_b at yahoo.com> wrote:
> Markus Neteler wrote:
> > http://trac.osgeo.org/grass/changeset/30007
> ...
> > +  # strangely "" counts as 1
> > +  NAMELEN=`echo "$newcol" | wc -c | awk '{print $1}'`
> > +  if [ "$NAMELEN" -gt 11 ] ; then
>
>
> the extra char is due to the newline:
>
> $ echo "" | wc -c
> 1
> $ echo -n "" | wc -c
> 0

ah, right.
Question: is "-n" portable? I darkly remember some issue.

Markus

> For v.db.renamecol + SQLite and DBF, should we add extra checks like
> 'v.info -c' or even compare before/after v.db.select counts to check
> that new column is there and contains data before calling v.db.dropcol?
>
> I guess it's a matter of paranoia vs. wasted redundant effort how far
> you go with that.
>
>
> Hamish


More information about the grass-dev mailing list