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

Re: var expansion in glob pattern?



On Mar 23,  7:36pm, Bart Schaefer wrote:
}
} except that passing [the glob expression] as the argument to "ls"
} may do the wrong thing when there are no matches at all.

Hmm, just noticed that my solution is also off when there are no matches,
because "${#${(f)...}}" didn't behave the way I expected on empty string
(returns 1 rather than 0).  So really:

    j=0
    for i in 1 2 3 4 5 10 15 20 25 30 35 40 35 40 45 50; do
      print ${(l:3:)i}k : "$[${#${(f)$(print -l x *(N.Lk-${i}Lk+${j}))}}-1]"
      ((j=i-1))
    done
    print Rest : "$[${#${(f)$(print -l x *(N.Lk+${j}))}}-1]"

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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