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

Re: Set difference between sets of files



On Tue, 05 May 2009 11:00:10 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> typeset -A differ
> eval differ\[${(q)^MASTER_FILES}\]=a
> eval differ\[${(q)^BACKUP_FILES}\]=b
> print -l -- ${(k)differ[(R)a]}

Wow, but I think that has problems with certain characters, too.

% MASTER_FILES=("one[two")                        
% eval differ\[${(q)^MASTER_FILES}\]=a 
zsh: differ: assignment to invalid subscript range

I was trying to come up with something that "just works", which is
difficult if you're manipulating variable substitution and usually ends
up looking like a bus smash.  (The glob qualifier solution to the orginal
problem should work fine, though.)

("Bus smash" may be British slang; it indicates ugliness.)

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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