I try to remove string from .bash_profile. String is added when my shell script run:My string at bash_profile as follows:# for Myapllicationexport MYAPP_HOME=/opt/myappI want to remove the strings from .bash_profile when myapp is removed via rpm. How to remove any string from a file via shell script? (or possible alternative method)
How to remove any string from a file via shell scripts?
linux;shell script;bash script
You can remove a string from a text file with sed(others tools exist).For example:sed -i -e '/myapp/d' .bash_profileremoves from .bash_profileevery line containing the string myapp.