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

Re: ~/.zshenv or ~/.zprofile



In the last episode (Aug 04), Nikolai Weibull said:
> I've always put all my environment stuff in ~/.zshenv.  Lately,
> however, I've come to realize that that may not be such a good idea. 
> I mean, the environment is passed down as it is, why tell shells the
> same information again?  The problem really is that if you put, for
> example, your PATH definition in ~/.zshenv, and have a script or
> application that modifies PATH and later runs a shell, that shell
> will not use the specifically crafted PATH, but will read the
> standard one from ~/.zshenv.  An example would be procmail with
> ~/.procmailrc.  I have the lines:
> 	PATH="/usr/bin:/bin"
> 	SHELL="/bin/zsh"
> in my ~/.procmailrc.  I recently realized that, as I had set the
> shell for procmail to invoke sub-processes with to Zsh, that the PATH
> setting had no effect.  This was rather bad, as I was doing some echo
> debugging in my ~/.zshenv and a lot of mails got messed up in the
> process.  So, anyway, is there _any_ reason to put stuff in
> ~/.zshenv, and, if so, what?

zshenv is the only script sourced by cron jobs, so I put PATH and shell
functions I might use in scripts in there.  BTW - do this so you don't
override an existing PATH:

path=(/usr/local/bin /usr/local/sbin /sbin /usr/sbin /bin /usr/bin $path)
typeset -U PATH # remove duplicate entries

-- 
	Dan Nelson
	dnelson@xxxxxxxxxxxxxxx



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