I have some lines stored in a text file called bashrc_snippet
. I would like to insert them into .bashrc
. Since I sometimes change the contents of the text file I would like to be able to re-insert them in the .bashrc-file. To do this I want to use marker lines:
# User things
HISTSIZE=1000
#START
alias ls='ls --color=tty'
... some more lines
#END
I would like a bash script to do this (possibly by using sed or awk). The algoritm should be:
- If the marker lines are missing add them at the end of the file (and the lines of text)
- If the marker lines are present, replace the contents between them with the new lines of text