I have a file having a list of key-value pairs which I need to set as environment variables. I need to write a script which reads the key-value pairs from the file and set them as env variables. These env variables must be available for future application launches or new shell launch in the current login session. Is this possible?
One solution is writing the set of key-value pairs to /etc/environment file. But every time we run the script duplicate key-value pairs can be added to the /etc/environment file. How can this issue be solved?