From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27808 invoked by alias); 28 Jan 2015 18:40:18 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34428 Received: (qmail 13821 invoked from network); 28 Jan 2015 18:40:16 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=Ko/6AtSI c=1 sm=1 tr=0 a=FT8er97JFeGWzr5TCOCO5w==:117 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=YNv0rlydsVwA:10 a=eR8pbWZPYqCyeaQkcWcA:9 a=CjuIK1q_8ugA:10 From: Bart Schaefer Message-id: <150128103928.ZM3554@torch.brasslantern.com> Date: Wed, 28 Jan 2015 10:39:28 -0800 In-reply-to: Comments: In reply to Dave Yost "managing PATH, MANPATH, LD_LIBRARY_PATH, etc." (Jan 28, 10:06am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: managing PATH, MANPATH, LD_LIBRARY_PATH, etc. MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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.