setup_shellrc.py now creates .bashrc if no file for login startup information is found

This commit is contained in:
Martin Diehl 2012-06-22 14:18:42 +00:00
parent 84f3a2d8f8
commit beda30302a
1 changed files with 5 additions and 1 deletions

View File

@ -4,7 +4,7 @@ import os,sys,string,re
from optparse import OptionParser
validShells = {\
'bash':['.bashrc','.bash_profile','.bash_login','.profile'],
'bash':['.bashrc','.bash_profile','.bash_login','.profile','new'],
'csh': ['.cshrc'],
}
@ -89,6 +89,10 @@ theHome = os.getenv('USERPROFILE') or os.getenv('HOME')
if theShell == 'bash':
for theRC in validShells[theShell]:
if theRC =='new' and not hitSomething:
print 'Could not find a file to store bash information, creating .bashrc in home directory'
theRC='.bashrc'
open(os.path.join(theHome,theRC), 'w').close()
thePath = os.path.join(theHome,theRC)
if os.path.exists(thePath):
print thePath