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

Re: using the "source" command in a "for" loop



> > # need to export the vars, or they're lost when leaving the loop

No, they are not lost.

> I guess something changed because this even worked for 3.0.0.  No  
> matter, as long as it works now
> 
> I changed:
> 	$i="$ZDOTDIR/$i"
> to
> 	export $i="$ZDOTDIR/$i"

The first version does not work because zsh tries to assign the parameter
named `$i'.  You have to use eval to assign the value of $i.  Although this
worked without eval up to zsh-3.0.0 it was never documented.  You can use

eval $i='"$ZDOTDIR/$i"'

Zoltan



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