Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh startup files



On Tue, Mar 14, 2006 at 05:38:37PM +0000, zzapper wrote:
> I've got everything in my ~/.zshenv can I do better?

Doing this means that you can't override anything that is set in the
.zshenv file and have it affect another zsh script or indeed any command
that was spawned using $SHELL (which affects a lot of commands that run
other commands, such as gdb).  Because of this, I moved all my non-
interactive variable settings into ~/.zprofile (my interactive settings
have always been in ~/.zshrc) and I reduced the ~/.zshenv file to these
3 lines:

if [[ $SHLVL == 1 && ! -o LOGIN ]]; then
    source ~/.zprofile
fi

The overall idea is that I want these variables to be set once, and then
inherited from then on.  The reason for the above 3 lines is that some X
windows environments don't start a login shell for an xterm, so this
code makes sure that a top-level shell that is not a login shell still
includes the zprofile information that would have been included
automatically by a login shell.  If you have other settings that you
always want to be forced into a certain state regardless of the parent
environment, you could set them there as well.

..wayne..



Messages sorted by: Reverse Date, Date, Thread, Author