From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25994 invoked from network); 17 Jun 2004 17:26:44 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.86) by ns1.primenet.com.au with SMTP; 17 Jun 2004 17:26:44 -0000 Received: (qmail 23769 invoked from network); 17 Jun 2004 17:25:00 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Jun 2004 17:25:00 -0000 Received: (qmail 25869 invoked by alias); 17 Jun 2004 17:24:37 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7560 Received: (qmail 25847 invoked from network); 17 Jun 2004 17:24:37 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.86) by sunsite.dk with SMTP; 17 Jun 2004 17:24:34 -0000 Received: (qmail 19502 invoked from network); 17 Jun 2004 17:21:35 -0000 Received: from sj-iport-3-in.cisco.com (HELO sj-iport-3.cisco.com) (171.71.176.72) by a.mx.sunsite.dk with SMTP; 17 Jun 2004 17:21:34 -0000 Received: from sj-core-5.cisco.com (171.71.177.238) by sj-iport-3.cisco.com with ESMTP; 17 Jun 2004 10:23:25 +0000 X-BrightmailFiltered: true Received: from cns-build4.cisco.com (cns-build4.cisco.com [128.107.183.19]) by sj-core-5.cisco.com (8.12.10/8.12.6) with ESMTP id i5HHL3iJ011065; Thu, 17 Jun 2004 10:21:04 -0700 (PDT) Received: (paullew@localhost) by cns-build4.cisco.com (8.11.2/CISCO.WS.1.2) id i5HHL3f28764; Thu, 17 Jun 2004 10:21:03 -0700 (PDT) From: Paul Lew MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16593.54015.756728.550098@cns-build4.cisco.com> Date: Thu, 17 Jun 2004 10:21:03 -0700 To: Peter Stephenson Cc: zsh-users@sunsite.dk Subject: Re: How to clean up path most efficiently? In-Reply-To: <200406171634.i5HGYAmE011684@news01.csr.com> References: <20040617161149.80189.qmail@web60310.mail.yahoo.com> <200406171634.i5HGYAmE011684@news01.csr.com> X-Mailer: VM 7.18 under Emacs 21.3.1 X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 >>>>> "Peter" == Peter Stephenson writes: >> I have tons of directories in my $PATH, but only a handful of >> them are needed in each my machine; other directories simply do >> not exist. How could I clean up the non-existing dirs from my >> $PATH most efficiently? Doing a for loop in ~/.zshrc just for >> that sounds a bit overkill, but at least I couldn't spot >> anything like this on man page. Peter> It should be as simple as: Peter> path=($^path(N)) This is cool. Few questions for efficiency here: (1) which one is more efficient? The parameter expansion with NULL_GLOB or read in the ready list from disk? Originally I setup the path with a loop that will check for [[ -d $dir ]] but the speed is greatly improved with the cached file. Since most of the dir in our path are auto mounted, caching seems the better way. (2) when is zsh rehash the path? vared path? path=(...) ? If path is rehased everytime path is updated, then will it be bad practice to do: PATH=a:b:c PATH=$PATH:d:e PATH=$PATH:f:g This is to make the script fit on terminal width but will it be costly? TIA.