Bash Shell Script - If with Find not returning what I expected <p>My program:</p> <pre><code>find teste1 | while read -r firstResult do find teste2 | while read -r secondResult do if [[ $firstResult == $secondResult ]]; then echo "$firstResult" "$secondResult" &gt; equal.lst else echo "$firstResult" "$secondResult" &gt; notEqual.lst fi done done </code></pre> <p>Now, my problem is that when it searches the contents of the find on the "<code>IF</code>" command, it isn't saving the differences on "notEqual" nor the equals to "equal".</p> <p>Am I doing something wrong or missing anything?</p> <p>If you don't know the answer or can at least point me in a better direction, I would trully appreciate it! :)</p> <p>What I want from the program as a total:</p> <p>Search a directory and whilst doing this, search another directory, if any of the searches on those directories match each other, save it to "equal", if not, save it to "notequal".</p> <p>I need this program so I can find which files have been renamed or deleted and so on.</p> <p>----------EDIT----------------</p> <p>After seeing other comments, I tried messing around with Differ:</p> <pre><code>find teste1 -type f | while read -r firstResult do find teste2 -type f | while read -r secondResult do diff -rs $firstResult $secondResult done done </code></pre> <p>The problem with this one is that it does find some "identical" files, however, the "identical" for this means the files with the same .extension, could I remove this possibility somehow?</p> <p>----------EDIT 2----------------</p> <p>Ok, so, hopefully this will be my last EDIT and will finally post an ANSWER, I did some modifications to my original program and I know it's not as farfetched as most of those that are around here but it got me pretty damn close to where I wanted and since I am a noob, please bare with extensiveness of the program when it could be much smaller:</p> <pre><code>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" &gt;&gt; equal.lst else echo "$firstResult" "$secondResult" &gt;&gt; notEqual.lst fi done done </code></pre> <p>Now... My final dillema and I think it's quite easy: This only finds and saves files with the exact cases and I'd like, imagine as this -> You have a folder on 1 directory, now someone comes and saves another folder just like that (different content) on another directory but "renames" the folder to a different casing, as in 1st dir "tEsT" and 2nd dir "test". The program won't consider those two as the same, how do I change this? I have heard of case sensitive but I don't know exactly "where" to put it.</p>