[GRASS-dev] return of the OSX xterm question

William Kyngesburye woklist at kyngchaos.com
Sun Apr 8 19:41:03 EDT 2007


Messing around today, and I recalled the discussion about how to get  
grass-xterm-wrapper to use an OSX Terminal.  I think I figured out  
something that could work.  Combining Lorenzo's AppleScript sample  
and Glynn's way to strip the command out of the parameters and a  
little experimentation, I have a relatively simple script to do this.

Though simple - it's all handled in grass-xterm-wrapper, so there is  
no need to rewrite scripts - it's a bit of a messy AppleScript hack.

The main problem I couldn't fix is that the AppleScript command to  
run a shell script in the Terminal chokes on large command strings (1  
byte over 1K), and a large string is needed to pass the env vars to  
the Terminal.  So I pass them in byte-sized (hee hee) pieces, and  
there is the potential that the user can interrupt this by switching  
to another Terminal window.

But it's fast enough that it shouldn't be a serious problem.

To test this, replace lib/init/grass-xterm-wrapper with this one and  
rebuild GRASS, or replace the installed grass/etc/grass-xterm- 
wrapper.  Before running GRASS, set GRASS_XTERM=Terminal.app in your  
~/.bash_profile.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: grass-xterm-wrapper
Type: application/octet-stream
Size: 2761 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20070408/e864db4e/grass-xterm-wrapper.obj
-------------- next part --------------

I tested it in the Tcl GUI startup mapset screen, choosing New  
Location by Projection Values.


One thing I'm wondering - is there a way to run a command in a shell  
script without displaying the command in the shell?  Something like  
the @ prefix used in makefiles?  Since I have to recreate the env  
vars in the new Terminal window, a lot of stuff is spewed to the user  
before the requested command is actually run.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"History is an illusion caused by the passage of time, and time is an  
illusion caused by the passage of history."

- Hitchhiker's Guide to the Galaxy




More information about the grass-dev mailing list