No need to use tr
, bash has its own built in case conversion (${var,,}
). Also, no need for -iname **
with find, leaving this out will match all files by default.
#!/bin/bash
find teste1 -type f | while read -r firstResult
do
find teste2 -type f | while read -r secondResult
do
firstName="${firstResult##*[/|\\]}"
secondName="${secondResult##*[/|\\]}"
if [[ "${firstName,,}" == "${secondName,,}" ]]; then
echo "$firstResult" "$secondResult" >> equal.lst
else
echo "$firstResult" "$secondResult" >> notEqual.lst
fi
done
done