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

Ivan Shmakov ivan at theory.asu.ru
Fri Feb 8 12:21:48 EST 2008


>>>>> Markus Neteler <neteler at osgeo.org> writes:

[...]

 >> 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.

	It's mandated by POSIX at least [1].  Besides, it's already used
	widely in the GRASS scripts:

grass $ grep -rF '[ -n ' scripts/
... numerous...
grass $ 

	One may also use [ x"$varn" != x ] instead, but I'd be against
	such a practice (unless for a good reason.)

[...]

[1] http://www.opengroup.org/onlinepubs/009695399/utilities/test.html



More information about the grass-dev mailing list