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

Re: find duplicate files



Paul Hoffman wrote:

>> >     #!/bin/zsh
>> >     find-duplicates () {
>> >          (( # > 0 )) || set -- *(.N)
>> >          local dups=0
>> >          md5sum $@ | sort | awk '{ print $2,$1 }' | uniq -c -f1 | \
>> >                      grep -v '^  *1 ' | wc -l | read dups
>> >          (( dups == 0 )) && echo "no duplicates"
>> >     }
>> 
>> Still nothing :)
>
> What were you expecting? It exits with status
> 0 if there were no duplicates; otherwise, it
> exits with status 1.

OK! Yes, it works. Thank you. I put your name
next to it in the file [1]. Only I expected it
to tell what files are duplicates. Otherwise it
isn't so useful :)

> # is the name of a variable (a "variable" is
> zsh terminology). Its value is the number of
> positional parameters, i.e., the number of
> elements in $argv. Within (( ... )) you don't
> need the dollar sign before a variable name,
> but (for the most part) it doesn't hurt to
> use it

OK, thanks. Better to use the dollar sign so
that it doesn't brake the font lock and look
like a comment.


[1] http://user.it.uu.se/~embe8573/conf/.zsh/files-fs

-- 
underground experts united
http://user.it.uu.se/~embe8573



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