I'm using Ubuntu 9.04
I'm trying to add some system-wide envvars, I want them to be visible to both bash and zsh(my main shell), I added them to /etc/profile but unfortunately I can't see them in zsh
I found that Ubuntu has a file /etc/environment that's only meant for envvars(as opposed to general scripts) but zsh doesn't honor that file.
When I try to source /etc/profile manually I get the following output(I guess it doesn't parse it to the end)
$ source /etc/profile
/etc/profile:5: no matches found: /etc/profile.d/*.sh 2 Answers
The manual page zsh(1) states that zsh reads /etc/zsh/zprofile. You could simply add a command there which sources /etc/profile.
The correct answer should be to use /etc/environment like:
MYVAR=myvaluebecause it is shell agnostic. Environment variables set there apply to all shells (sh, bash, zsh, etc.) for all accounts. Reference here (Also applies to Ubuntu and other distros).
If you tried it and it didn't work, you probably forgot to logout and back in for it to take effect. As for /etc/zsh/zprofile, mine already contains (By default) a line which sources /etc/profile:
emulate sh -c 'source /etc/profile'