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

Two array/glob expansion questions



There are two things with arrays/lists/globs I've recently been unable to 
tease out the syntax for.  Neither seems particularly diabolical, and both 
are easy with looping or xargs, but I was wondering if there were shorter 
versions:

1. Given an array of things, create an array of those things as flag 
arguments:

e.g., via loops # disregarding "There are better ways to specify this"
$ list=( some directories to ignore )
$ for dir in $list ; args+=( --exclude $dir )
$ rsync $args -av blah/ blah/

2. Given a glob expression, append something to each resulting filename.

e.g., I have a directory containing .wav files with corresponding .flac 
files.  (same $file:e name).  Is there a particularly slick way to 
specify: "all the .flac files whose corresponding .wav files have length
>100"?

$ for wav in ~/path/to/*.wav(L+100:r).flac ; do something ; done

In this particular example, it's easy to use :s/.wav/.flac, but if I were 
globbing a bunch of images, say:

$ touch ~/path/to/*.(#i)(gif|png|jpg)(Lk+100).is_large

Is there something that doesn't look like line noise that would do it?

Best,
Ben



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