From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28138 invoked by alias); 5 Apr 2011 09:23:40 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15938 Received: (qmail 12497 invoked from network); 5 Apr 2011 09:23:38 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at bewatermyfriend.org does not designate permitted sender hosts) From: Frank Terbeck To: Helmut Jarausch Cc: Zsh Users Subject: Re: [FAQ] PATH surgery In-Reply-To: <1301992478.30839.0@numa-i> (Helmut Jarausch's message of "Tue, 05 Apr 2011 10:34:38 +0200") References: <1301992478.30839.0@numa-i> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Date: Tue, 05 Apr 2011 11:04:47 +0200 Message-ID: <87wrj9jcgg.fsf@ft.bewatermyfriend.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Df-Sender: 430444 Helmut Jarausch wrote: > what's the simplest way to do some surgery on the PATH environment > variable. While vared is interactive I'll need to > > - split / join the PATH into an array of PATH's components > - remove the first or any given component > - search for a component containing a given string $path is an array that's tied to $PATH. So basically, the splitting is done for you already. The two parameters are updated with the other. You could remove entries like this: path[1]=() path[-1]=() or even path[(re)/home/foo/bin]=() Regards, Frank -- In protocol design, perfection has been reached not when there is nothing left to add, but when there is nothing left to take away. -- RFC 1925