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

Re: root's path



On 17 March 2012 12:13, Christian Neukirchen <chneukirchen@xxxxxxxxx> wrote:
> "Benjamin R. Haskell" <zsh@xxxxxxxxxx> writes:
>
>> On Sat, 17 Mar 2012, sergio wrote:
>>
>>> Hello.
>>>
>>> How zsh sets root's $path (and $PATH)?
>>> bash uses /etc/profile, for sudo completion there are /etc/zsh/zshrc
>>> and $PATH for non root is in /etc/zsh/zshenv. But I can't find root
>>> path anywhere.
>>
>> Zsh often ends up using /etc/profile or the equivalent.  On Gentoo,
>> for example, /etc/zsh/zprofile sources /etc/profile.env.  On OpenSUSE,
>> /etc/zprofile sources /etc/profile.
>
> Shouldn't $PATH be set in /etc/zshenv rather than zprofile?
> Else, it's impossible to override $PATH in ~/.zshenv.

Absolutely not, if you set PATH from *env, it makes it impossible to
inherit the PATH from the parent process' environment, even in
scripts, which will break a lot of things. The path should only be set
once on login of the current session, ie in zprofile if zsh is your
login shell, otherwise in the startup file for your login shell.

-- 
Mikael Magnusson



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