zsh-users
 help / color / mirror / code / Atom feed
From: Steven Klass <sklass@pointcircle.com>
To: zsh-users <zsh-users@sunsite.dk>
Subject: Re: path and += troubles
Date: Sat, 26 Nov 2005 07:54:35 -0700	[thread overview]
Message-ID: <E350C29B-12FD-4276-8EA3-D13B4E11AE41@pointcircle.com> (raw)
In-Reply-To: <20051126132557.GH13460@ay.vinc17.org>

Hi,

This exposes one of my personal problems with typeset.  If I really  
want a path appended typeset -U will drop the appended path, in favor  
of the path which already exists.  So IMHO the only way to handle  
this properly is to
	
	Normalize the new path ($2) - Remove any trailing slashes ensure no  
double-slashes
	Check to see if the new path exists in the old path array ($1) and  
delete it
	Append or Prepend the new path to the $1
	
Here's some of the cleanup stuff I read about in this list..
	path=($^path(N))
	setopt EXTENDED_GLOB
	path=(${${path//\/##/\/}%/})
	unsetopt EXTENDED_GLOB
	typeset -U path

But can anyone please explain my number 1 item - that is really  
annoying me..

	appendPath() {
		# if the path exists delete it..
		deletePath $1 $2
		# Append the path to the end..
		$1+=($2)
	}

	1.  Why does += not work when adding to the array - It should right?


---

Steven Klass

sklass@pointcircle.com
(480) 988-5657

On Nov 26, 2005, at 6:25 AM, Vincent Lefevre wrote:

> On 2005-11-26 10:32:35 +0100, Christian Taylor wrote:
>> I never bothered about a deletion function, because I simply use:
>> typeset -U path
>> which will keep only the first occurence of any element.
>
> But if a same path is written in two different ways, it doesn't
> recognise it:
>
> ay:~> echo $library_path
> /home/lefevre/./lib /home/lefevre/./lib /home/lefevre/lib /usr/ 
> local/gmp/lib
> ay:~> typeset -U LIBRARY_PATH
> ay:~> echo $library_path
> /home/lefevre/./lib /home/lefevre/lib /usr/local/gmp/lib
>
> -- 
> Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/ 
> blog/>
> Work: CR INRIA - computer arithmetic / SPACES project at LORIA


  reply	other threads:[~2005-11-26 14:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-26  4:32 Steven Klass
2005-11-26  9:32 ` Christian Taylor
2005-11-26 13:25   ` Vincent Lefevre
2005-11-26 14:54     ` Steven Klass [this message]
2005-11-27  1:30       ` Vincent Lefevre
2005-11-26 17:00 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E350C29B-12FD-4276-8EA3-D13B4E11AE41@pointcircle.com \
    --to=sklass@pointcircle.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).