Simpler bash commands for linux PBA

This commit is contained in:
Shreya 2020-06-13 19:37:01 +05:30
parent a9c763cd9c
commit e2d35ca267
1 changed files with 5 additions and 8 deletions

View File

@ -3,14 +3,11 @@ BASH_STARTUP_FILES = ["~/.bashrc", "~/.profile", "~/.bash_profile"]
def get_linux_commands_to_modify_shell_startup_files(): def get_linux_commands_to_modify_shell_startup_files():
return [ return [
'if [ -f {0} ] ;', # does the file exist? 'echo \"# Succesfully modified {0}\"',
'then', '3<{0} 3<&- |', # check for existence of file
'echo \"# Succesfully modified {0}\" |', 'tee -a', # append to file
'tee -a', '{0}',
'{0}', # add comment to file
'&&', '&&',
'sed -i \'$d\' {0} ;', # remove last line of file 'sed -i \'$d\' {0}', # remove last line of file
'else',
'echo \"{0} does not exist\" ; fi' # mention if file does not exist
],\ ],\
BASH_STARTUP_FILES BASH_STARTUP_FILES