[GRASS5] [bug #3710] (grass) d.m - store commands in the history

Michael Barton michael.barton at asu.edu
Sat Oct 8 12:44:33 EDT 2005


Although the d.m layers don't write to the command history upon display,
they CAN be saved as a "group". This group can then be opened in the future,
reinitializing all the saved GIS Manager layers.

To get the commands to save to the command history, you'd need to write a
shell script with the same commands. This is pretty easy because, when you
push the display button, all the commands get written to the terminal. From
there, you can cut and paste them into a shell script--or just to the
terminal one by one to populate the command history.

As with many things in GRASS, if you can't do it one way, there are a couple
other alternative methods to achieve the same or similar results.

Hope this is helpful.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402

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



> From: Glynn Clements <glynn at gclements.plus.com>
> Date: Sat, 8 Oct 2005 10:59:24 +0100
> To: Markus Neteler via RT <grass-bugs at intevation.de>
> Cc: <werchowyna at epf.pl>, <grass5 at grass.itc.it>
> Subject: Re: [GRASS5] [bug #3710] (grass) d.m - store commands in the history
> 
> 
> Markus Neteler via RT wrote:
> 
>>> Are you referring to ~/.bash_history (and similar)? Those files belong
>>> to the shell; d.m shouldn't be messing with them.
>> 
>> I guess that he refers to $MAPSET/.bash_history where d.m IMHO could
>> add commands without too many problems.
> 
> It isn't quite that simple.
> 
> 1. Changes to the history file won't effect existing processes unless
> you force them to re-read the history file with "history -r".
> 
> 2. bash doesn't simply append commands to the history file as they are
> entered. It writes out the history in one go upon termination (or when
> forced with "history -w"). So, commands appended to the file by
> another process won't appear in the "right" place in the history.
> 
> 3. Multiple shells can use the same history file; different shells
> will read commands from different offsets in the file. E.g. if you
> have three shells running, quit them, start 3 new shells, each new
> shell will start where one of the others left off in terms of their
> history.
> 
> 4. d.m doesn't use a shell; it uses Tcl's "exec" command. A shell
> command is a string, while a Tcl's exec command takes a list of
> strings. Tcl would have to generate an equivalent shell command
> according to the syntax rules for the shell (which might not be bash).
> 
> -- 
> Glynn Clements <glynn at gclements.plus.com>
> 
> 
> 




More information about the grass-dev mailing list