From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122 invoked from network); 6 Sep 2006 04:02:07 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-25) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO,UNPARSEABLE_RELAY autolearn=ham version=3.1.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 6 Sep 2006 04:02:07 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 85956 invoked from network); 6 Sep 2006 04:02:00 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 6 Sep 2006 04:02:00 -0000 Received: (qmail 9366 invoked by alias); 6 Sep 2006 04:01:51 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10687 Received: (qmail 9357 invoked from network); 6 Sep 2006 04:01:50 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 6 Sep 2006 04:01:50 -0000 Received: (qmail 84797 invoked from network); 6 Sep 2006 04:01:46 -0000 Received: from vms042pub.verizon.net (206.46.252.42) by a.mx.sunsite.dk with SMTP; 6 Sep 2006 04:01:46 -0000 Received: from torch.brasslantern.com ([71.116.118.106]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0J550050DKIHRS8K@vms042.mailsrvcs.net> for zsh-users@sunsite.dk; Tue, 05 Sep 2006 23:01:30 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id k8641Sgg011472 for ; Tue, 05 Sep 2006 21:01:28 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id k8641S1W011471 for zsh-users@sunsite.dk; Tue, 05 Sep 2006 21:01:28 -0700 Date: Tue, 05 Sep 2006 21:01:27 -0700 From: Bart Schaefer Subject: Re: Where PATH is set In-reply-to: <20060905183120.GA10848@cetus30.cs.utk.edu> To: zsh-users@sunsite.dk Message-id: <060905210127.ZM11470@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <20060905183120.GA10848@cetus30.cs.utk.edu> Comments: In reply to Chris Johnson "Where PATH is set" (Sep 5, 2:31pm) On Sep 5, 2:31pm, Chris Johnson wrote: } } I have a political question I could use some help on. My system } administrators currently set PATH in /etc/zshrc. This is at least preferable to RedHat's idea of what belongs in that file, which *still* includes "bindkey ' ' magic-space" and loading of some files from /etc/profile.d/ that install aliases. My personal opinion is that the only thing that belongs in /etc/zshrc is setting the default shell prompt, and I'm a bit leery even of that. In any case it's redundant to set something in /etc/zshenv and then set it again in any other /etc/z* file. NOTHING stops /etc/zshenv from being read; many things can bypass the rest of the files. } The assignment is literal; no existing value is checked for. They } assign the exact same thing to PATH in /etc/zshenv so that "ssh } machine command" will work the same way. Assigning PATH in /etc/zshenv is a perfectly reasonable thing to do, particularly if important commands may reside in unexpected locations like /opt/bin/ or even /usr/local/bin/. Most exported variables are reasonable candidates for /etc/zshenv, but practially nothing else is, except maybe resource limits. } This setup forces me to similarly assign PATH twice, once in ~/.zshenv } and once in ~/.zshrc. You could always put "setopt NO_GLOBAL_RCS" in ~/.zshenv and cause all the rest of the /etc files to be skipped. I used to do that, but those /etc/profile.d/ files that annoy me so are unfortunately shared with /etc/profile for bash, and therefore are are necessary to set up the environment properly (e.g., for X11). So, now, I do fun things like builtin alias alias='[[ $0 = /etc/* ]] || \alias' which renders the alias command a no-op when it appears in any file under /etc/. If your sysadmins are doing export PATH=.... then you could play the same trick with the export command; but more likely they have the assignment and the export as separate steps. } I think this is a horrible setup, a trap for inconsistencies just } waiting to snare users, but the sysadmins think its a non-issue. Sysadmins have a different set of priorities. They want to keep the clueless from complaining, because it's much easier to deal with the clueful -- even though you whine more, there aren't as many of you. Put your PATH assignment (really, I hope it's a path assignment, the array syntax is so much cleaner) in a third file, and "source" that file from both ~/.zshenv and ~/.zshrc.