I have a file which has environment variable listed like
 VAR_NAME=abc
and this file is sourced when needed. I want to add a new environment variable to the file if it's not present already. How do I search this file and replace/add a new value to it?
I was doing this till now:
echo "string_created" >> fileName
this just appends a line and after few runs there were multiple lines with diff values. I can remove this file after one run of my program but that isn't definitive.