From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25705 invoked by alias); 28 Jan 2015 18:06:33 -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: 34427 Received: (qmail 8849 invoked from network); 28 Jan 2015 18:06:20 -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=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:content-type:subject:date:message-id:to:mime-version :sendlaterdate; bh=IcL3MU6i0olVYmJC5hvnVWIavAQdp/7Qlo/lV7Z4O0Y=; b=JF8tWVWR9AtSWiiBvBQPZs+Ef+5kW2cZ+VCQgnvvdXRiqXwFEYB9Ux+pDMcYfY1gqG Lt0Tmvgu9/3yLi6JER2WobqY5t4VfuOKsvbNJBrk0F0R05jrRiZ5kwTu5qsx+C/Ozsmj C2k/fKYtuITIwvQ6bcO8vczo+tvRe08odwNJ/lW1ZFiBKeQE9tXy/nObxid7iTOyGqRc lUZDIrbOVsy5nkq5B953RwWEGU2CVtoniT9mozAGqfWSq937blwP4PAWYB3yRDfnOhT2 79GMBNFxld5AmNouRRri5MEtdJe5wyiMRYt30ugHLY+IIz4F21/vraigT3d1AQLCyCjk vt8Q== X-Received: by 10.66.122.69 with SMTP id lq5mr8061533pab.52.1422468375559; Wed, 28 Jan 2015 10:06:15 -0800 (PST) Sender: Dave Yost From: Dave Yost X-Google-Original-From: Dave Yost Content-Type: multipart/alternative; boundary="Apple-Mail=_4105AC2E-F58F-4B22-A170-0F5B91E6B731" Subject: managing PATH, MANPATH, LD_LIBRARY_PATH, etc. Date: Wed, 28 Jan 2015 10:06:12 -0800 Message-Id: To: zsh-workers@zsh.org Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Sendlaterdate: Wed, 28 Jan 2015 10:06:12 -0800 X-Mailer: Apple Mail (2.1993) --Apple-Mail=_4105AC2E-F58F-4B22-A170-0F5B91E6B731 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 AFAIK we have no choice in zsh but to tediously add things individually = by hand to the various path environment variables. The Environment = Modules System = for linux = gives higher-level control, but it=E2=80=99s a whole ball of wax of its = own. If I do this module load llvm/3.5.1 then the relevant directories from /usr/local/llvm/3.5.1 will be added = to the front of PATH, LD_LIBRARY_PATH, LIBRARY_PATH, and CPATH, or = whatever paths have been specified in the =E2=80=9Cmodulefile=E2=80=9D = for llvm/3.5.1. A zsh shell function could allow similarly convenient manipulation of = paths, without buying into the whole Environment Modules thing. Imagine a shell function called =E2=80=9Cpaths=E2=80=9D. 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=E2=80=99t exist, such as = /usr/local/sbin, are not added. An important convenience of the paths function would be that it also = works similarly for MANPATH, LD_LIBRARY_PATH, LIBRARY_PATH, and CPATH. 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 with the obvious effects (including removing from paths before adding at = the desired position), and paths list would output like this /usr/local/llvm/3.5.1 /usr/local /usr / One notable exception is adding =E2=80=9C.=E2=80=9D to PATH. The paths = function could help here, too: paths --no-subdirs --only=3DPATH addlast . On my Mac, here=E2=80=99s what=E2=80=99s in /etc/paths /usr/local/bin /usr/bin /bin /usr/sbin /sbin But what about MANPATH, LD_LIBRARY_PATH, LIBRARY_PATH, and CPATH? The = paths function could be smart enough to eat /etc/paths as input, = stripping off the /bin part of each item and then doing: paths /usr/local /usr / That way /etc/paths wouldn=E2=80=99t have to change. Better would be a = new overriding file, called /etc/prefixes or something, that just has a = list of arguments to the paths function: /usr/local /usr / Comments? Volunteers? Is this already out there somewhere? I do not plan to implement this anytime soon. Dave= --Apple-Mail=_4105AC2E-F58F-4B22-A170-0F5B91E6B731--