[GRASS-dev] erratic behavior of v.in.ascii with WinGRASS

Glynn Clements glynn at gclements.plus.com
Tue Feb 5 09:17:50 EST 2008


Helena Mitasova wrote:

> I did few more experiments (with a different file, but still
> generated by GRASS - this time using v.out.ascii)
> and it indeed looks like the fs=| is responsible
> for the truly erratic behavior - I think that without quotes it is  
> represented as
> pipe(?) so depending on where you put it you get different response:
> 
> at the end of the command:
> GRASS 6.3.cvs (nc_spm_sed):~/grassdata/indata/ncdata > v.in.ascii  
> ftest.txt out=test2 fs=|
>  >
> and nothing happens
> 
> or in the middle, before output (it never gets to it)
> 
> GRASS 6.3.cvs (nc_spm_sed):~/grassdata/indata/ncdata > v.in.ascii  
> ftest.txt fs=| out=test2
> 
> ERROR: Required parameter <output> not set:
>      (Name for output vector map).
> 
> I am wondering whether there are other commands that would need to  
> have this fixed
> (at least on man page).
> fs=| is default so it is probably rarely used (at least on command  
> line), but apparently
> in needs quotes

The "|" is a shell metacharacter (for both bash and cmd.exe), and
needs to be escaped or quoted if you want to use it in an argument,
e.g.:

	v.in.ascii ftest.txt fs=\| out=test2
or:
	v.in.ascii ftest.txt fs='|' out=test2
or:
	v.in.ascii ftest.txt fs="|" out=test2

[Use the last one on Windows.]

Without the backslash or quotes, the command will be parsed as:

	v.in.ascii ftest.txt fs= | out=test2

This runs v.in.ascii with the separator set to the empty string, and
its stdout redirected to the shell command "out=test2" (i.e. an
assignment).

The Tcl/Tk GUI doesn't use the shell to execute commands, so it
shouldn't be an issue there.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list