[Pkg-zsh-devel] Bug#776663: zsh-common: Wish for /etc/zsh/zprofile.d or equivalent

Frank Terbeck ft at bewatermyfriend.org
Fri Jan 30 23:10:27 UTC 2015


Hey Tim,

Tim Booth wrote:
[...]
> This is a request on behalf of Bio-Linux and the Debian Med
> developers. The attached file shows the zshrc used on Bio-Linux, and
> the part we'd really like to see in the standard zsh-common package is
> support for a zprofile.d configuration directory[...]

Is there a specific problem you'd like to address? I'm not a big fan of
these kitchen sink directories everybody and their dog gets to dump
stuff into. Especially in “/etc” since it's kind of hard for a package
to remove stuff from there again.

> In Bio-Linux this is hooked from zshrc but actually a modified zprofile
> probably makes more sense.
>
> This is pretty trivial to implement, as far as I can see.  What do you think?
[...]
> for i in `( setopt null_glob ; echo -n /etc/zsh/zshrc.d/*.zsh )` ; do

Ungh... Don't do it like this! Just use globbing to create a list of
files. The idea about "null_glob" is sound in itself (even though in zsh
solvable differently, using the "N" glob qualifier). But since you do
this test in the loop:

>     if [ -r $i ]; then
>       source $i

you don't need null_glob at all. Thus, I'd do this:

for i in /etc/zsh/zshrc.d/*.zsh; do
    # I'm quoting the parameter, because someone might have
    # set the SH_WORD_SPLIT option in, say "~/.zshenv".
    if [ -r "$i" ]; then
        source "$i"
    fi
done


Regards, Frank



More information about the Pkg-zsh-devel mailing list