[GRASS-dev] Re: MS-Windows native GRASS

Michael Barton michael.barton at asu.edu
Mon Sep 18 10:27:19 EDT 2006


Thanks for this clarification. Now I have a couple more specific questions.


> From: Glynn Clements <glynn at gclements.plus.com>
> Date: Mon, 18 Sep 2006 11:32:12 +0100
> To: Michael Barton <michael.barton at asu.edu>
> Cc: Huidae Cho <grass4u at gmail.com>
> Subject: Re: MS-Windows native GRASS
> 
> 
> Michael Barton wrote:
> 
>> Can you give an example of how you need to run a bash script under windows?
> 
> If $cmd is a script, you need to explicitly specify the interpreter.
> E.g.:
> 
> exec $cmd $arg1 $arg2
> 
> needs to be changed to:
> 
> exec sh $cmd $arg1 $arg2  # for a shell script
> or:

This should go into the runandoutput.tcl procedures. Can this be used for
all systems, or do I need to specify that this syntax is for mysys platforms
only? env(HOSTTYPE)=???

> exec $env(GRASS_WISH) $cmd $arg1 $arg2 # for a Tcl/Tk script
> etc.

Running a tcltk script from within tcltk shouldn't need this should it
(i.e., from within a WISH environment)? Calling wish should only be
necessary when starting a tcltk script from the command line or its
equivalent in mysys, right? This would be in the gis.m script.


> 
> Note that:
> 
> exec sh -c "$cmd $arg1 $arg2"
> 
> will work in some cases, but not all, so shouldn't be used.
> 
>> Sorry, but I don't quite get it yet. You suggest that this same syntax also
>> runs under unix. Under Linux? Mac? I'm happy to test it on the Mac and at
>> least a flavor or two of Linux.
> 
> It's unnecessary under Unix (including OSX); you can just execve() a
> script, and the kernel will detect the #!/bin/sh and invoke /bin/sh
> automatically.
> 
> This isn't the case on Windows. Unix emulation layers (e.g. Cygwin,
> MinGW's bash) include specific code to detect scripts and invoke the
> interpreter.

So it's an issue with mysys only? Does it hurt to specify sh up front for
ALL, or do we need to do this only for mysys platforms?

Thanks

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

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton





More information about the grass-dev mailing list