-
-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
grass.py: Evaluate ^export lines only and expand variables in double/non-quoted values #170
Conversation
…non-quoted values
…non-quoted values
|
Non ^export variables will be written into .bashrc in the mapset directory and get evaluated by bash. For example, This PS1 doesn't start with |
|
Maybe off-topic here but I'd love to see that the standard aliases defined in ~/.bashrc would be visible within a GRASS GIS session... |
|
Maybe, we can source ~/.bashrc, but I'm wondering why we create a new bashrc for each mapset. |
Do we change $HOME and start a new bash process for 1. storing history and 2. non-interactive batch jobs from non-regular users (e.g., apache)? |
|
works, but if the whole purpose of this new bash process is for non-interactive jobs... I'm not sure if you want to do this. |
… from .grass.bashrc)
|
I moved |
I have not clue... maybe a relict from ancient times? |
Maybe for history in each mapset? |
|
This PR should allow sourcing ~/.bashrc from ~/.grass7/bashrc and fix the issues mentioned in the first comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add comments, so it is easier to investigate the code later.
|
I agree with this PR that the current code needs revising. If you are a command line user, you expect to get your aliases. The home switch code just seems hacky. We were discussing this in the past both the home and the aliases. Here are some links and quotes (mixed from all threads): [GRASS-dev] [GRASS-SVN] r61051 - grass/trunk/lib/init [GRASS-dev] Bash aliases in GRASS [GRASS-user] loss of bash aliases Vaclav Petras:
Glynn Clements:
Ivan Shmakov:
Huidae Cho:
Vaclav Petras:
|
|
Added comments. Actually, Glynn made a point. We could just add GRASS-specific environment variables in ~/.bash_profile and do nothing to start GRASS, but I'm not sure if that's a good idea... We want at least some kind of data protection from regular bash uses. |
I don't think that's a good idea. If we want GRASS GIS modules to be available by default in command line without starting a session, then they should be just normal command line tools installed to the system. However, I don't think that's how it should be done and I would rather do the subcommand interface like version control systems or new ImageMagick. |
Totally agreed. Since this PR only fixes unintended bugs, I'll merge it for now if it works on your machine. |
|
I've addressed Vaclav's comments and, since there are no more comments, I'll take the liberty and merge this PR. |
|
Backported to relbranch78 |
This PR properly evaluates ^export in single lines in ~/.grass7/bashrc. It will ignore multi-line environment variables. Without this PR,
defines
With this PR, the same lines would define