On Unix, is there any way that one process can change another's environment variables (assuming they're all being run by the same user)? A general solution would be best, but if not, what about the specific case where one is a child of the other?
Edit: How about via gdb?
Via gdb:
(gdb) attach process_id
(gdb) call putenv ("env_var_name=env_var_value")
(gdb) detach
This is quite a nasty hack and should only be done in the context of a debugging scenario, of course.
'putenv' has unknown return type; cast the call to its declared return type
; in those cases you should change putenv
call to this: call (int) putenv ("env_var_name=env_var_value")
— Feb 20, 2019 at 09:33