zsh-users
 help / color / mirror / code / Atom feed
* Do I really need a .zshenv?
@ 2001-08-27 19:38 Russell Hoover
  2001-08-27 20:41 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Russell Hoover @ 2001-08-27 19:38 UTC (permalink / raw)
  To: zsh-users

I have a ~/.zshenv in which I've set 25 to 30 environment variables.
My ISP's /etc/zprofile sets about six env vars which I've re-set
in my ~/.zshrc.

( The order of zsh startup files on my system is:

(1)  ~/.zshenv
(2)  /etc/zprofile
(3)  ~/.zprofile
(4)  ~/.zshrc )

I'd like to avoid, if possible, having *two* separate startup files,
both of which contain env vars.

I'd like to move everything that's in my ~/.zshenv over into my ~/.zshrc.

That way, as I see it, I won't have to worry about /etc/zprofile ever
changing, or having more variables added, and then me having to re-set
anything.  It's basically just an annoyance that /etc/zprofile overwrites
~/.zshenv.

(And since my ~/.zshrc has a fairly long list of aliases, I can move all
them into their own file and source that file from within ~/.zshrc.)

(I also have a small ~/.zprofile.)

My question: is there any reason for me to keep a .zshenv, instead of
taking all the settings that are in it, and putting them in ~/.zshrc,
and just getting rid of ~/.zshenv altogether?

Is ~/.zshrc sourced *only* in interactive shells and not on *all*
invocations of the shell (as ~/.zshenv is)?  If so, how much (why) would
that matter to me?  (scripts, etc?)    Thanks for any suggestions.

-- 
                                 // rj@panix.com //


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Do I really need a .zshenv?
  2001-08-27 19:38 Do I really need a .zshenv? Russell Hoover
@ 2001-08-27 20:41 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2001-08-27 20:41 UTC (permalink / raw)
  To: Russell Hoover, zsh-users

On Aug 27,  3:38pm, Russell Hoover wrote:
}
} I'd like to move everything that's in my ~/.zshenv over into my ~/.zshrc.
} 
} Is ~/.zshrc sourced *only* in interactive shells and not on *all*
} invocations of the shell (as ~/.zshenv is)?

Yes, .zshrc (and /etc/zshrc) is for interactive shells only.

/etc/zprofile, ~/.zprofile, /etc/zlogin and ~/.zlogin are for *login*
shells only.

It's possible in some odd circumstances to have a login shell that is not
interactive -- for example, some X11 display managers run their initial X
client startup scripts via such a shell (I believe the Gnome desktop does
this; it drove me nuts trying to figure out why my X session was exiting
before it ever got started, and it turned out that I was assuming login
shells were interactive at one unfortunate point in .zprofile).

} If so, how much (why) would that matter to me?  (scripts, etc?)

Scripts, processes started on a remote machine with `rsh' or `xon', and
the aforementioned X11 display manager startups could all have different
behavior if the environment were set up entirely in .zshrc.  Whether
that matters to you depends on what sorts of commands you run this way.

Also, if the environment has already been set up properly by zprofile or
zlogin, there may be no need to reset it every time a new interactive
shell starts up.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-08-27 20:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-27 19:38 Do I really need a .zshenv? Russell Hoover
2001-08-27 20:41 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).