Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: managing PATH, MANPATH, LD_LIBRARY_PATH, etc.
On Jan 28, 10:06am, Dave Yost wrote:
}
} Imagine a shell function called "paths". Doing this:
} paths set /usr/local /usr /
} wants to set PATH to this:
} /usr/local/bin
} /usr/local/sbin
} /usr/bin
} /usr/sbin
} /bin
} /sbin
} and does so, except that directories that don't exist, such as
} /usr/local/sbin, are not added.
Two things that occur to me:
(1) It's often a policy thing that only adminstrator users have "sbin"
directories in their path.
(2) There's really no reason to exclude non-existent directories, they
have no interesting effect on path search particularly given zsh's use
of the command hash table. Unless they cause some problem for other
programs' use of other PATH-like variables?
} An important convenience of the paths function would be that it also
} works similarly for MANPATH, LD_LIBRARY_PATH, LIBRARY_PATH, and CPATH.
CPATH is GCC specific and only for build environments (isn't it?). How
many such special cases might there be, and how would "paths" decide
when to in/exclude them?
} You can also do these:
} paths remove /usr/local/llvm/3.5.1
} paths addlast /usr/local/llvm/3.5.1
} paths addfirst /usr/local/llvm/3.5.1
"append" and "prepend"?
} Comments? Volunteers? Is this already out there somewhere?
Seems pretty similar to "add-zsh-hook" except with some extra rules.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author