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

Re: PATCH: Re: :r modifier



> >>> "adl" == Alexandre Duret-Lutz <duret_g@xxxxxxxxxxxxx> writes:
>
> Here are the results on some error-prone inputs:
> 
> % for x in a.b//c //e ///g.h /i/j/k/ l.m ..
> for> print "$x\t root=$x:r\text=$x:e,\thead=$x:h,\ttail=$x:t"
> a.b//c   root=a.b//c    ext=,   head=a.b,       tail=c
> //e      root=//e       ext=,   head=//,        tail=e
> ///g.h   root=///g      ext=h,  head=/, tail=g.h
> /i/j/k/  root=/i/j/k/   ext=,   head=/i/j,      tail=k
> l.m      root=l ext=m,  head=., tail=l.m
> ..       root=. ext=,   head=., tail=..
>
> and unpatched zsh:
>
> % for x in a.b//c //e ///g.h /i/j/k/ l.m ..
> for> print "$x\t root=$x:r\text=$x:e,\thead=$x:h,\ttail=$x:t"
> a.b//c   root=a ext=b//c,       head=a.b/,      tail=c
> //e      root=//e       ext=//e,        head=/, tail=e
> ///g.h   root=///g      ext=h,  head=//,        tail=g.h
> /i/j/k/  root=/i/j/k/   ext=/i/j/k/,    head=/i/j/k,    tail=
> l.m      root=l ext=m,  head=l.m,       tail=l.m
> ..       root=. ext=,   head=..,        tail=..

I've just committed Alexandre's patch, with the effects shown.  Watch out
for unexpected results from colon modifiers.  With a bit of luck, in most
places where they are used the new behaviour should actually reduce
unexpected results.  Andrej:  note that this uses `\\' as well as `/' for
paths in Cygwin.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070



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