Browse Source

grass.py: Strip trailing whitespaces after ^export lines in .grass7/bashrc

Huidae Cho 5 years ago
parent
commit
110edbf5be
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lib/init/grass.py

+ 2 - 1
lib/init/grass.py

@@ -1160,7 +1160,7 @@ def load_env(grass_env_file):
     if not os.access(grass_env_file, os.R_OK):
         return
 
-    export_re = re.compile('^export[ \t]+([a-zA-Z_]+[a-zA-Z0-9_]*)=(.*)$')
+    export_re = re.compile('^export[ \t]+([a-zA-Z_]+[a-zA-Z0-9_]*)=(.*?)[ \t]*$')
 
     for line in readfile(grass_env_file).split(os.linesep):
         m = export_re.match(line)
@@ -1176,6 +1176,7 @@ def load_env(grass_env_file):
             v = v.strip('"')
         elif v.startswith("'") or v.endswith("'") or v.startswith('"') or v.endswith('"'):
             # ignore multi-line variables
+            debug("Ignore multi-line environmental variable {0}".format(k))
             continue
         if expand:
             v = os.path.expanduser(os.path.expandvars(v.replace('\$', '\0')).replace('\0', '$'))