Append exports to end of .bash_profile instead of overwriting
authorEthan White <ethan@weecology.org>
Fri, 20 Sep 2013 00:33:17 +0000 (20:33 -0400)
committerW. Trevor King <wking@tremily.us>
Mon, 21 Oct 2013 17:07:16 +0000 (10:07 -0700)
In the process at an explanation of where the lines came from
so that users know they can remove the lines if desired.

setup/bin/swc-nano-installer.py

index f27aac1bf72632bc5d7cd58ea9e2b0b0298d2c26..67dd7e8b5683687ddea0a27bafeb101a9ffd53b5 100644 (file)
@@ -48,12 +48,13 @@ def make_bash_profile(home_dir, nano_dir):
     """
 
     nano_path = make_posix_path(nano_dir)
-    contents = '\n'.join([
-        'export PATH=$PATH:%s' % nano_path,
-        'export EDITOR=nano',
-            '',
-            ])
-    with open(os.path.join(home_dir, '.bash_profile'), 'w') as f:
+    contents = '\n'.join(['',
+                          '# Add nano to path and set as default editor',
+                          '# Added by the Software Carpentry nano installer',
+                          'export PATH=$PATH:%s' % nano_path,
+                          'export EDITOR=nano',
+                          ''])
+    with open(os.path.join(home_dir, '.bash_profile'), 'a') as f:
         f.write(contents)
 
 def make_posix_path(windows_path):