[gobolinux-devel] env vars in /etc/zprofile instead of zshrc
Jonatan Liljedahl
lijon at kymatica.com
Tue Apr 1 10:58:01 NZDT 2008
Michael Homer wrote:
> On Tue, Apr 1, 2008 at 10:27 AM, Jonatan Liljedahl <lijon at kymatica.com> wrote:
>> Nick Matteo wrote:
>> > On Mon, Mar 31, 2008 at 8:41 AM, Jonatan Liljedahl <lijon at kymatica.com> wrote:
...
>> > Moving everything to /etc/zprofile won't work because the main concern
>> > is to make sure it's loaded in all _interactive_ shells. (which
>> > zprofile isn't, it's only login shells; zshrc on the other hand is for
>> > exactly this.) You could have zshrc source zprofile, or you could
>> > just let scripts run in sh (which they pretty much all do) and leave
>> > the slim config running sh --login (which it does by default) and
>> > everything will be fine.
>>
>> No, zprofile is loaded for all login shells, and zshrc is loaded for
>> interactive shells *additionally*. So I really think that zshrc should
>> contain only stuff related to interactive shells, like prompt and
>> aliases, etc.. while important setup, variables (like PATH and programs
>> Environment files) should be in zprofile.
> Neither xterm nor any of its derivatives start login shells by
> default, so zprofile would not be loaded in them and mayn't have been
> beforehand. See the zsh guide for exactly what gets loaded when:
> http://zsh.sunsite.dk/Guide/zshguide02.html#l9
Are you sure? When I start an xterm by simply typing 'xterm' in another
xterm, I get one with stuff from my ~/.zprofile loaded. In case it
inherits the variables from the parent xterm, then it's no problem
because it would do it also from other parent shells (like slims X session).
In case of important environment variables, they could even be put in
zshenv which are read by all shells, login or not.
--
/Jonatan [ http://kymatica.com ]
More information about the gobolinux-devel
mailing list