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

Re: Expansion bug?



Zoltan replyeth:
> Chris Hillery <cjh@xxxxxxx> wrote:
> >   set -A cdpath $ROOT/{$PROJ,${(j:,:)PROJ_LIST}}/src
> > 
> > This expanded via brace-expansion into a collection of paths like so:
> > 
> >  /root/project/src /root/a_proj/src /root/b_proj/src    etc.
>
> The proper way to do this in recent zsh releases is
> 
> set -A cdpath $ROOT/{$PROJ,${^PROJ_LIST}}/src

Nope, unfortunately this doesn't work either - or rather, it works TOO
well. What happens in that case is that I get the value in PROJ
repeated in front of every value in $PROJ_LIST, so (using my above
example) cdpath turns into

  /root/project/src /root/proj_a/src /root/project/src /root/proj_b/src

Which, as it happens, actually works fine for a cdpath; it's just
redundant and inefficient. (And cdpath gets real huge real quick when
$PROJ_LIST has 10 entries...)

> However your original method probably still works if glob_subst is set (I
> haven't tried). There was a bugfix which changed that.

However, THIS works just fine - it returned the functionality I had in
beta1. So far this is the only way I've found to get the behaviour I
want, although Soren sent me mail showing how I could get almost the
same behaviour with rcexpandparam set (it worked with the simple
$ROOT/$PROJ_LIST/src case, and I had to manually prepend
$ROOT/$PROJ/src).

So, thanks... :)  (Hopefully globsubst won't have any other unwanted
side-effects...) 

> Cheers,
>    Zoltan

-- 
Ceej
aka Chris Hillery
cjh@xxxxxxx



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