Re: Manipulating Environment Variables of an Already running process

Michał Nazarewicz <[email protected]>
Newsgroups gmane.linux.newbie
Message-ID <[email protected]>
W dniu 13 października 2010 23:23 użytkownik Hatem Nassrat
<[email protected]> napisał:
> 2010/10/13 Michał Nazarewicz <[email protected]>
>> 2010/10/12 Hatem Nassrat <[email protected]>:
>> > A usecase, changing the PS1 environement var of an already running
>> > bash process from another bash process.
>>
>> No. And even if it were possible you have no guarantees that the other
>> process will reread the environment variables.
>
> Well the use case I gave is one where the env var gets reread for each
> new prompt.

I wouldn't bet on it without looking at bash's code. Bash could just
copy PS1 to some
internal structures and read it rather than environment variable.

> Direct memory manipulation seems to be the only way I can think of,
> but I do not think this is possible in userland. I was thinking maybe
> there is a hidden sys call that might make this possible, like a very
> hacky and unstable IPC :), yeah there is no sane reason for such a
> feature but it would be cool to know if its at all possible.

No such thing. Process's memory is its own (unless process wants to share it).
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.