Please use
[code][/code] tags around your code and data, to preserve formatting and to improve readability. Please do not use quote tags, colors, or other fancy formatting.
You have a pretty good start, but there are a couple of things you should beware of.
Code:
nazwy=$(find . -type f | awk -F '/' '{print $NF}' | sort | uniq -d)
1)
Don't read lines with for. Filenames can contain any character (except '
/' and
null), including newlines. If this command ran across one, it would break. At the very least use
find's
-print0 option, and the related
-z option to
sort and
uniq, to delimit filenames by null terminators instead.
2) Don't store lists of files inside a single variable. That's what
arrays are for.
How can I use array variables?
http://mywiki.wooledge.org/BashFAQ/005