From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7479 invoked from network); 22 Jun 2004 19:47:39 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.86) by ns1.primenet.com.au with SMTP; 22 Jun 2004 19:47:39 -0000 Received: (qmail 18905 invoked from network); 22 Jun 2004 19:47:09 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 22 Jun 2004 19:47:09 -0000 Received: (qmail 15279 invoked by alias); 22 Jun 2004 19:46:45 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7586 Received: (qmail 15269 invoked from network); 22 Jun 2004 19:46:44 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.86) by sunsite.dk with SMTP; 22 Jun 2004 19:46:41 -0000 Received: (qmail 17965 invoked from network); 22 Jun 2004 19:46:41 -0000 Received: from knife.dreamhost.com (postfix@66.33.219.6) by a.mx.sunsite.dk with SMTP; 22 Jun 2004 19:46:39 -0000 Received: from [192.168.2.120] (adsl-68-252-38-239.dsl.wotnoh.ameritech.net [68.252.38.239]) by knife.dreamhost.com (Postfix) with ESMTP id 99598E4178 for ; Tue, 22 Jun 2004 12:46:37 -0700 (PDT) User-Agent: Microsoft-Entourage/11.0.0.040405 Date: Tue, 22 Jun 2004 15:46:33 -0400 Subject: Re: How to clean up path most efficiently? From: Timothy Luoma To: Message-ID: In-Reply-To: <200406171634.i5HGYAmE011684@news01.csr.com> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit 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=BAYES_50 autolearn=no version=2.63 X-Spam-Hits: 0.0 On 6/17/04 12:34 PM, "Peter Stephenson" wrote: > Jarkko Maja wrote: >> 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. yeah I did something like this a long time ago, but since it rarely changes per-machine, it was overkill PATH="" for dir in /usr/bin /bin /sbin /usr/local/sbin /usr/local/bin $HOME/bin do if [[ -d $dir ]] then PATH=$dir:$PATH fi done (Note: that list of dirs is in reverse order of preference due to the way the loop is put together, to avoid ':' as the first character in the PATH string. > It should be as simple as: > > path=($^path(N)) Does that go through the current $PATH and delete all the folders that aren't listed in there? Is it supposed to be lowercase? TjL