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

Re: Two array/glob expansion questions



2009/8/27 Benjamin R. Haskell <zsh@xxxxxxxxxx>:
> 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/

You can do it easily if you don't need two new words to be created,
ie if --exclude=$dir is valid, you can do rsync --exclude=$^list -av blah/ bluh/
(doing --exclude\ $^list won't work)

-- 
Mikael Magnusson



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