You are not logged in.
I have a laptop which goes from a connection with a http proxy to one without, so I have to change it constantly.
I can write a script with the line
export http_proxy='example.com:8080'
But it doesn't work across all sessions.
I use screen, with 5 or so zsh session 'tabs'.
Is there a way to have the variable set on a parent process to cascade down to child processes, or otherwise set it once, globally? (Ideally in a script that I can set to run automatically.)
Thanks guys.
(What I think I want is a global environment variable.)
Offline
If you put it in .zshrc, you have to source it in all the active zsh sessions.
Last edited by karol (2010-10-05 11:51:12)
Offline
If you put it in .zshrc, you have to source it in all the active zsh sessions.
True, but I change my proxy settings far more than I start sessions; I'd still have to enter
source ~/.zshrc
in each zsh session...
Offline
IIRC each shell instance has it's own execution environment set when you start that shell instance. You can
alias zz="source ~/.zshrc"
to make it quicker.
Offline
IIRC each shell instance has it's own execution environment set when you start that shell instance. You can
alias zz="source ~/.zshrc"
to make it quicker.
That also works, but is there any way to script that?
(Sorry to be a pain, but surely there's a way to do this, to set this environment variable for all sessions at once.)
Offline
You can set environmental variable, but are you sure your shell will be aware of that? Try it out and see for yourself.
If you set it and start a new session, this will work but I don't know how to "update" the current ones.
Offline
You can make an infinitive loop inside .zshrc which will setup env. var. like $http_proxy, every second. So once you edit it in one term. session it will be set up across all of them.
Offline
Changing an environment variable will only be noticed by child processes. Changing the variable in one shell instance will not reflect in another.
Offline