[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

Moritz Lennert mlennert at club.worldonline.be
Tue Oct 24 04:39:04 EDT 2006


On Tue, October 24, 2006 02:49, Glynn Clements wrote:
>
> 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
    while executing
"image create photo mapimg.$mon -file "$outfile($mon)""
    (procedure "MapCanvas::composite" line 21)
    invoked from within
"MapCanvas::composite $mon"
    (procedure "MapCanvas::drawmap" line 40)
    invoked from within
"MapCanvas::drawmap $mon"
    (procedure "MapCanvas::display_server" line 9)
    invoked from within
"MapCanvas::display_server"
    ("after" script)

When I put them in, the map displays as it should.


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

Moritz




More information about the grass-dev mailing list