I’m writing a shell script that I want to add an alias to the end of the alias list in the .bashrc file. I’m thinking something with sed would work, just not sure how to find the last line that begins with alias, then add on the next line another alias.
I’m writing a shell script that I want to add an alias to the
Share
Why do you need to add it to an “alias list”? If you don’t have additional requirements that you did not specify in the question, just append your alias to
.bashrc: