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

Re: Set difference between sets of files



Bart Schaefer wrote:
> Thd following is arcane, but seems to do the trick:
> 
> MASTER_FILES=('a[b' '$cd' 'ef}' 'g h' 1 2 3)
> BACKUP_FILES=('a[b' '$cd' 'ef}')
> 
> typeset -A differ
> eval 'differ[${:-'${(q)^BACKUP_FILES}'}]=b'
> eval 'differ[${:-'${(q)^MASTER_FILES}'}]=a'
> print -l -- ${(k)differ[(R)b]}

Interesting, it's worth remembering that ${:-<something quoted>} gets
you out of jail with quoting parameter subscripts.

> } ("Bus smash" may be British slang; it indicates ugliness.)
> 
> I got the ugliness, but if that's rhyming slang I haven't managed to
> un-rhyme it.

It relies on a visual rather than and auditory metaphor.  I won't post a
link to a picture, which would be in bad taste.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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