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

Re: zsh startup files



>>>>> "Peter" == Peter Stephenson <pws@xxxxxxxxxxxxxxxxx> writes:
> `No, this idea isn't popular', or `No, I am at war with the sysadmin who
> doesn't make it easy'?

I meant: no, the sysadmin(s) often just refuse changing something that
(they claim) works.  The mere fact that it makes user-configs clunky is
nor considered important enough to take the risk of screwing up something
in the config.  Furthermore, they generally aren't even able to understand
what the problem is and will give you answers like "well, with our default
config I couldn't reproduce your problem".

> Potentially, they may be useful, but I certainly agree they're overused and
> often abused.  On this system here, we have /etc/zprofile, /etc/zshenv and
> /etc/zshrc --- and they're almost identical.

Given my above description, I think software should always make it hard
for the sysadmin to screw up and abuse a config.  Currently, zsh tends to
encourage such abuse (for instance /etc/zshrc should always be replaced by
a `source /etc/user/zshrc' in the /etc/skel/.zshrc file so that the user
is given the choice to turn it off or call it at some other time).

>> I guess I could live with just NO_GLOBAL_RCS that I would
>> set in my .zshenv although it won't do me any good as a sysadmin.
> (Do you mean GLOBAL_RCS_FIRST, or are you proposing a different option for
> not running global scripts apart from /etc/zshenv at all?)  If it worked in.

I'm proposing a new option.

> .zshenv, it would certainly be made to work in /etc/zshenv: the question
> would be whether it should have an effect in .zshenv as well.

I think that any such flag should just take effect immediately, no matter
when it is set.  `setopt norcs' if executed in .zshrc should prevent
/etc/zlogin and .zlogin from being executed.

> Again, if you mean, `how do I get all my code to run after the global
> scripts have finished', then I can't see any problem with the following,
> but I haven't tried it out, so I may have missed something.  I've relied on
> the fact that .zshrc is run for any interactive shell (option interactive
> is set), and .zprofile and .zlogin for any login shell (option login set),
> and that a login shell is always interactive.  That should answer your
> other question.

I was thinking of using something more like

    % cat .zshenv
    ...
    ...blabla...
    ...
    setopt norcs
    [[ -o login ]] && source .zprofile
    [[ -o interactive ]] && source .zshrc
    [[ -o login ]] && source .zlogin
    %

Sadly, it seems that `setopt norcs' only takes effect in /etc/zshenv.
Why was that deemed desirable ?
How can I prevent /etc/zshrc from being sourced for interactive shells.


	Stefan



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