I have no problem adding config files to a given script, but automatically updating them is another matter. In this instance I'm providing a few variables to a script, and I'd like the script to be able to change the values provided by the config file. Is there a standard way to change the value of a variable in a running script, and then update the config file accordingly? My current approach is sed-ing for the line containing the variable and changing its contents, but I feel like there must be a better way.
For example, imagine a program that generates some arbitrary text file:
Line in config file, defining a variable available to the program:
EXIT_ON_GEN="true" //exit on successful generation of text file if true
The user selects a menu option that indicates they would like to stay in the program instead, because they like generating arbitrary text so much. It would be easy to simply set it to false for the current instance of the program, but what's the best way to change the config file itself, so the user doesn't have to go back and change the settings each time they run it?