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

Re: Invocation of zshenv



Am Donnerstag, 17. Januar 2013, 06:58:47 schrieb Bart Schaefer:
> On Jan 17, 10:23am, Florian Lindner wrote:
> }
> } So [/etc/profile] sets and exports the PATH but does not take a
> } already set PATH variable into account. If .zshenv is sourced before
> } /etc/profile that would explain it. But why only on SSH shells not on
> } usual shells?
> 
> How do you typically create a "usual shell"?  Log in on console, or
> open a terminal window on a graphical desktop?

Ok, I just found out that it works only when using the shell from my graphical 
environment (KDE).

Login from a text console or SSH does not work. But .zshenv is invoked in any 
case. I suspect that the two latter cases (text + SSH) are login shells and 
/etc/profile is evaluated. This file simply sets and not append/prepend to a 
existing PATH.

> If the latter, it's possible that ssh shells are being invoked as
> login shells whereas "usual" shells are not.  This will depend on the
> configuration of the terminal emulator.

I concur.

> 
> Try putting
> 
>     setopt NO_GLOBAL_RCS
> 
> in your .zshenv to see if that suppresses /etc/profile.  However, you
> may not want that in general, depending on what other environment the
> global init files are establishing for you.  Instead you may simply
> need to reset the path again in a later file.

It works (the PATH setting I did in .zshenv is there). But as you have guessed 
it fucks up my environment ;-)
 
> I put my path-setting logic in an extra file which is "source"d from
> both .zshenv and .zlogin (first and last files sourced at startup).
> This also has the advantage of making it easier to customize the path
> to each local host.

I changed my /etc/profile from

PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"

to

PATH="$PATH:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"

Any potential problems with that?

Thanks!

Florian



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