Opened 4 years ago

Last modified 4 years ago

#4007 new enhancement

grass.py and bash: respect aliases in $HOME/.bashrc

Reported by: neteler Owned by: grass-dev@…
Priority: normal Milestone: 7.8.3
Component: Default Version: git-releasebranch78
Keywords: bash Cc:
CPU: Unspecified Platform: Unspecified

Description

At time aliases defined in $HOME/.bashrc are not transferred into the GRASS GIS session (discussed in https://github.com/OSGeo/grass/pull/170 but not yet realised).

It would be way easier to work from command line if $HOME/.bashrc aliases were carried over into the current session.

As per variables.html, $HOME/.grass7/bashrc has to be written by the user which is unneeded extra work. Why this separate bashrc was invented at all, is unknown to me...

Indeed, there has been some related discussion in Feb 2013:

https://lists.osgeo.org/pipermail/grass-dev/2013-February/061857.html (and following)

Perhaps we can solve this in 2019/2020 :)

Change History (7)

comment:1 by hcho, 4 years ago

A workaround (current master) is to add

source ~/.bashrc

to $HOME/.grass7/bashrc.

I kind of understand why we have this separate bashrc (history for each mapset), but I'm not sure why we have two different places to read this file in grass.py: load_env (exports) and bash_startup (non-exports). Hopefully, we can make it cleaner soon.

Last edited 4 years ago by hcho (previous) (diff)

in reply to:  1 ; comment:2 by neteler, 4 years ago

Replying to hcho:

A workaround (current master) is ...

To make this work in G78 as well, we would have to backport

https://github.com/OSGeo/grass/pull/170

...right? If yes, are there any any objections to do so?

in reply to:  2 comment:3 by hcho, 4 years ago

Replying to neteler:

Replying to hcho:

A workaround (current master) is ...

To make this work in G78 as well, we would have to backport

https://github.com/OSGeo/grass/pull/170

...right? If yes, are there any any objections to do so?

You're right. No objection from me. Also, I guess this approach is better than "forcing" source ~/.bashrc. Clean aliases vs. inheriting them. Choice as long as we have a separate bashrc.

comment:4 by neteler, 4 years ago

ok I have backported it (pls squash-merge in future - I had to cherry-pick all commits individually).

Now: to be tested if it works in relbranch78

comment:5 by neteler, 4 years ago

Milestone: 7.8.2

Ticket retargeted after milestone closed

comment:6 by neteler, 4 years ago

Milestone: 7.8.3

in reply to:  4 comment:7 by hcho, 4 years ago

Replying to neteler:

ok I have backported it (pls squash-merge in future - I had to cherry-pick all commits individually).

I thought I used the Square and merge button in GitHub... Actually, this seems to be the only way to merge from there, I guess? Not sure what happened. Thanks for the backport!

Now: to be tested if it works in relbranch78

Version 0, edited 4 years ago by hcho (next)
Note: See TracTickets for help on using tickets.