Martin,
I think the following change has to be reverted because it breaks aliases and custom prompts defined in ~/.grass7/bashrc. Currently, only “NAME=VALUE” lines are parsed from this file in load_env().
Regards,
Huidae
···
On Thu, May 21, 2015 at 5:45 PM, <svn_grass@osgeo.org> wrote:
Author: martinl
Date: 2015-05-21 14:45:19 -0700 (Thu, 21 May 2015)
New Revision: 65307
Modified:
grass/trunk/lib/init/grass.py
Log:
grass.py: don’t overwrite environmental variables in bash_startup()
Modified: grass/trunk/lib/init/grass.py
— grass/trunk/lib/init/grass.py 2015-05-21 21:01:15 UTC (rev 65306)
+++ grass/trunk/lib/init/grass.py 2015-05-21 21:45:19 UTC (rev 65307)
…
@@ -1443,9 +1449,7 @@
path = os.path.join(userhome, “.grass.bashrc”) # left for backward compatibility
if os.access(path, os.R_OK):
f.write(readfile(path) + ‘\n’)
- if os.access(grass_env_file, os.R_OK):
- f.write(readfile(grass_env_file) + ‘\n’)
f.write(“export PATH="%s"\n” % os.getenv(‘PATH’))
f.write(“export HOME="%s"\n” % userhome) # restore user home path
Hi,
2015-07-08 18:31 GMT+02:00 Huidae Cho <grass4u@gmail.com>:
I think the following change has to be reverted because it breaks aliases
and custom prompts defined in ~/.grass7/bashrc. Currently, only "NAME=VALUE"
lines are parsed from this file in load_env().
sorry for delay, I took liberty to partly re-introduce r65307 in
r65585. It should work with aliases now.
Martin
--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
Thanks, Martin.
Is there any good reason why grass.py imports environment variables in load_env() and writes non-/^export/ lines (r65585 does not strip out whitespaces) into MAPSET/.bashrc in bash_startup() instead of simply sourcing or fully writing .grass7/bashrc? I see a couple of problems with this two step approach.
-
/^export/ lines in .grass.bashrc don’t work anymore with r65585. This file used to be “fully” written into MAPSET/.bashrc.
-
Conditional constructs like the following are not supported in .grass7/bashrc:
case $TERM in
xterm*)
export PS1=xterm # no space before export
;;
screen)
export PS1=screen
;;
esac
because load_env() would overwrite PS1 and bash_startup() won’t write out the /^export PS1/ lines. It will work if there are whitespaces before export, but I would say that was not intended by you…
Regards,
Huidae
···
On Tue, Jul 14, 2015 at 8:51 AM, Martin Landa <landa.martin@gmail.com> wrote:
Hi,
2015-07-08 18:31 GMT+02:00 Huidae Cho <grass4u@gmail.com>:
I think the following change has to be reverted because it breaks aliases
and custom prompts defined in ~/.grass7/bashrc. Currently, only “NAME=VALUE”
lines are parsed from this file in load_env().
sorry for delay, I took liberty to partly re-introduce r65307 in
r65585. It should work with aliases now.
Martin
–
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa