Con una versión reciente de bash
que maneja arreglos asociativos,lo siguiente también manejaría nombres de ruta con líneas nuevas incrustadas:
#!/bin/bash
topdir=$HOME
shopt -s globstar # enable the ** glob
declare -A count
# count the number of times each filename (base name) occurs
for pathname in "$topdir"/**; do
# skip names that are not regular files (or not symbolic links to such files)
[ ! -f "$pathname" ] && continue
# get the base name
filename=${pathname##*/}
# add one to this base name's count
count[$filename]=$(( ${count[$filename]} + 1 ))
done
# go through the collected names and print any name that
# has a count greater than one
for filename in "${!count[@]}"; do
if [ "${count[$filename]}" -gt 1 ]; then
printf 'Duplicate filename: %s\n' "$filename"
fi
done
Esto no utiliza ninguna utilidad externa.
Это было исправлено путем правильной настройки файла java. Переменная ENV для jdk home была экспортирована