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

Glynn Clements glynn at gclements.plus.com
Sat Oct 8 05:59:24 EDT 2005


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