Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: path and += troubles



On 2005-11-26 07:54:35 -0700, Steven Klass wrote:
> 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

This is a bad idea if the user has EXTENDED_GLOB set. Isn't it
possible to turn on EXTENDED_GLOB locally in parameter expansion?

> 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?

$1+=($2) doesn't make sense IMHO. You probably need an eval.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - 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



Messages sorted by: Reverse Date, Date, Thread, Author