[GRASS-dev] aliases in GRASS

Glynn Clements glynn at gclements.plus.com
Thu Feb 22 11:23:27 EST 2007


Robert Nuske wrote:

> I am trying to get my aliases in the GRASS-Shell, preferable from my .bashrc 
> (or at least a .alias-file).
> 
> If started form a bash, GRASS prepares its own .bashrc in the chosen Location 
> and starts a child shell (= GRASS-Shell) from there, as stated 
> in 'grass-6.3.cvs/etc/Init.sh'. This Shell knows only the setting from the 
> newly created .bashrc, so I guess I need to get my aliases in that file.

If you create a file called ~/.grass.bashrc, its contents will be
appended to the temporary .bashrc file. If you put ". ~/.bashrc" into
that file, it should source your original ~/.bashrc file ($HOME should
have been restored at that point).

> In line 815 in 'grass-6.3.cvs/etc/Init.sh'  a .alias-file is executed if it is 
> readable. Since the environment variable HOME is set to LOCATION in line 810 
> it looks for a .alias file in LOCATION and not in the users home directory, 
> is this intended?
> 
> If line 815 would read
>     echo "test -r ${USERHOME}/.alias && . ${USERHOME}/.alias" >> "$bashrc"
> instead of
>     echo "test -r ~/.alias && . ~/.alias" >> "$bashrc"
> the user's alias-settings would be carried over to the GRASS-Shell.
> 
> It would be even nicer if the GRASS-Startup-Script could parse my .bashrc, but 
> I have no idea how to achieve that.
>
> Looking forward to comments about the intention of line 815 
> in 'grass-6.3.cvs/etc/Init.sh' .

Probably someone forgot that $HOME hadn't been reverted at that point. 
Reverting $PATH and $HOME should probably come first. Actually, I'm
not sure that there's any need to mess with $HOME; AFAICT, it was done
so that the .bash_history file would get stored in the mapset, but
that can be achieved by setting HISTFILE.

More generally, Init.sh is somewhat over-engineered IMHO. It contains
lots of hacks which someone presumably thought were a good idea;
others may feel differently about them.

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




More information about the grass-dev mailing list