find . -depth -exec stat --format '%n %U %G' {} + | sort -d > acl_file_old
#some days later,do it again,and then compare
find . -depth -exec stat --format '%n %U %G' {} + | sort -d > acl_file_new
while read FILE OWNER GROUP; do
while read FILE_NEW OWNER_NEW GROUP_NEW; do
if [[ $FILE == $FILE_NEW ]]; then
echo "$FILE"
break
done < $result_dir/acl_file_new
done < $result_dir/acl_file_old
Run above bash script,When file name has white space,such as my file here
,while read FILE
works not well.
I already read similar post1,post2,I know looping over find's output is bad practice.The problem is I need save find -exec
result acl_file_old
first.
How to save find -exec
result and used to compare FILE OWNER
,regardless white space file name?