[GRASS-dev] gis.m in wingrass: using where clause in d.vect causes error :can't read "_data(.gronsole.gronsole, 9, donecmd)": no such element in array

Glynn Clements glynn at gclements.plus.com
Tue Oct 24 17:31:38 EDT 2006


Moritz Lennert wrote:

> >> > IOW, "sh -c '$cmd'" will only work for commands where none of the
> >> > arguments contain either Tcl or shell metacharacters. If you want to
> >> > invoke $cmd via "sh -c ...", you have to take the list apart and
> >> > construct a command line using shell syntax.
> >> >
> >> > E.g. (untested):
> >> >
> >> > 	set shcmd ""
> >> > 	foreach arg $cmd {
> >> > 		set arg2 [regsub -all {'} $arg {'\''}]
> >> > 		if {$shcmd == ""} {
> >> > 			set shcmd "'$arg2'"
> >> > 		} else {
> >> > 			set shcmd "$shcmd '$arg2'"
> >> > 		}
> >> > 	}
> >> > 	set cmd [concat | sh -c $shcmd]
> >>
> >> Finally gotten around to trying this. After adding simple quotes to the
> >> last line:
> >>
> >>       set cmd [concat | sh -c '$shcmd']
> >
> > That's wrong. There definitely shouldn't be quotes around the command
> > as a whole. If it doesn't work without them, that suggests that
> > something else is messing with the command.
> 
> When I don't put in these quotes, and I try to simply display a map, I get:
> 
> couldn't open "1708.1.ppm": no such file or directory
> couldn't open "1708.1.ppm": no such file or directory

As Michael says, the command isn't creating an image. Doesn't the
gis.m log provide any clues?

> >> > However, for various reasons, it would be better if we could find a
> >> > way avoid using "sh -c ..." altogether. The problem there is that you
> >> > can't directly execute shell scripts on Windows.
> >>
> >> agreed, but have we found a way for doing this, yet, at least
> >> theoretically ?
> >
> > Execute commands via a launcher program.
> 
> What would be the best choice of language for such a program.

C. The launcher needs to be a compiled executable, otherwise you run
into exactly the same problem (Windows doesn't understand "#!") when
running the launcher.

The alternative is to force scripts to have an extension (.sh for
shell scripts, .tcl for Tcl, etc). But then, you either need to type
the extension on Unix, or you have to ensure that scripts only have an
extension on Windows.

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




More information about the grass-dev mailing list