I'm using this bash script to check if the content of two paths
install1 passed as arguments is the same:
#!/bin/sh du -a $1 | grep -Po "[0-9]+\t$1/\K.*" | sort -n > list.txt du -a $2 | grep -Po "[0-9]+\t$2/\K.*" | sort -n > list1.txt cmp list.txt list1.txt
I'm running the script this way:
./compare-folders install install1
And the comparison between the file lists is failing:
list.txt list1.txt differ: byte 3557704, line 37504
Which should mean that at least one file present in one folder is missing in the other folder.
I checked the differences between
list1.txt using diffuse, and both files are missing some lines compared to the other. The first line missing in
list.txt but present in
list1.txt (i.e. the first file apparently not present in
install but present in
But the file is actually present in both folders. Same for other two files which I bothered to check.
What's strange about this is that the choice of lines to drop is apparently random, while running the script multiple times always produce the exact same result.
I'm classically missing something idiotic. I'm trying to sort out what it is, but as of now no luck.