Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Mon, 29 Jul 2002 07:48:38 +0200
From: "Gerrit P. Haase" <gp@familiehaase.de>
Organization: Esse keine toten Tiere
X-Priority: 3 (Normal)
Message-ID: <6234073304.20020729074838@familiehaase.de>
To: "Cyber.Zombie" <Cyber.Zombie@attbi.com>
CC: cygwin@cygwin.com
Subject: Re: Useful Cygwinism #2: PATH Despacifier/Deduplicateifier
In-Reply-To: <3D44C20F.7030005@attbi.com>
References: <NCBBIHCHBLCMLBLOBONKCEOEDCAA.g.r.vansickle@worldnet.att.net>
 <3D44C20F.7030005@attbi.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hallo Cyber.Zombie,

Am Montag, 29. Juli 2002 um 06:18 schriebst du:

> A suggested improvement:  Sometimes multiple paths are mount points to 
> the same directory and won't get noticed until the path has been 
> corrected.  The following rework will further cleanup $PATH:

> #!/usr/bin/perl -w
> #
> use strict;
> my @pathcomps;
> my @pathcomps_out;
> my %comps_seen_already;
> @pathcomps = split(/:/, shift);
> for(@pathcomps) {
>         my $path='"'.$_.'"';
>         $path=qx(cygpath -u \$(cygpath -ws $path));
>         $path=~tr/\n//d;
>         if(!exists($comps_seen_already{$path})) {
>                 push(@pathcomps_out, $path);
>                 $comps_seen_already{$path}=1;
>         }
> }
> print join(":", @pathcomps_out);

Where is the difference now to the first version?

>>=========================================================
>>#!/usr/bin/perl -w
>>use strict;
>>my @pathcomps;
>>my @pathcomps_out;
>>my %comps_seen_already;
>>@pathcomps = split(/:/, shift);
>>for(@pathcomps)
>>{
>>        if(!exists($comps_seen_already{$_}))
>>        {
>>                my $path;
>>                $path='"'.$_.'"';
>>                $path=qx(cygpath -u \$(cygpath -ws $path));
>>                $path=~tr/\n//d;
>>                push(@pathcomps_out, $path);
>>        }
>>        $comps_seen_already{$_}=1;
>>}
>>print join(":", @pathcomps_out);
>>==========================================================


-- 
=^..^=


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

