Your shell in which you run Emacs passes a copy of its environment to its child process (Emacs), as the value is passed from the shell to Emacs. Any change that Emacs makes to its legacy environment will only affect the Emacs process environment. The environment of Emacs can in no way affect the environment of the shell.
If you need to transfer information back to the shell, you must use various methods, such as temporary files, named pipes, sockets, ...
If you just want to test the Emacs environment, use Mx getenv to view the variables or use M-! echo $BLA . If this also shows sth else, then you probably have a special BLA that is automatically set to sth after each command or which is not writable at all like RANDOM or similar.
source share