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

Re: var expansion in glob pattern?



On Mar 23,  7:56pm, Sven Guckes wrote:
} Subject: var expansion in glob pattern?
}
}   $ for i in 1 2 3 4 5 10 15 20 25 30 35 40 35 40 45 50; do
}       ls *(.Lk-$i)|wc -l
}     end
}   zsh: parse error near `end'

You need "done" rather than "end", there.  There's nothing wrong with
the glob expression -- except that passing it as the argument to "ls"
may do the wrong thing when there are no matches at all.

Of course note that the files smaller than 50k includes all the files
smaller than 45k, and so on ... so I'd try:

    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 *(N.Lk-${i}Lk+${j}))}}"
      ((j=i-1))
    done
    print Rest : "${#${(f)$(print -l *(N.Lk+${j}))}}"

Detailed explanation available upon request.

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