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

Tidying MANPATH



Hi,

for years I've used these tricks seen at zsh mailing lists to remove non-existing paths from PATH/MANPATH:

# Path cleaning
path=($^path(N))                        # Remove non-existing dirs
manpath=($^manpath(N))
setopt EXTENDED_GLOB
path=(${${path//\/##/\/}%/})            # Remove trailing slashes,
manpath=(${${manpath//\/##/\/}%/})      # needs EXTENDED_GLOB
unsetopt EXTENDED_GLOB
typeset -U path manpath                 # Remove duplicate dirs

Now I've noticed that at least on Linux one can do a this kind of setting with MANPATH to also search system manpaths in addition to user's own paths:

MANPATH=/path1:/path2::/path3

That means that system manpaths are searched after /path1 and /path2 but before /path3. The problem is that while

manpath=($^manpath(N))

is probably the most clever one-liner I've seen it also removes the magical :: from manpath. The obvious question is that is there a way to spare :: easily or do I need to resort to some multi-line fixing with MANPATH?

Thanks!




      



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