问题
I use getfacl -RP ../www > permission_backup to store the permission and Beyond Compare to compare two permission_backup,if permission has any change,I will run setfacl --restore.
I found a problem,I run getfacl -RP ../www > permission_backup to the same folder twice,items in permission_backup may have different order,then Beyond Compare will tell me there's big different.
For example:
One permission_backup is as below:
# file: ../www/info/2013-09-05/16.html
# owner: apache
# group: apache
user::rw-
group::r--
other::r--
# file: ../www/info/2013-09-05/1.html
# owner: apache
# group: apache
user::rw-
group::r--
other::r--
# file: ../www/info/2013-09-05/23.html
# owner: apache
# group: apache
user::rw-
group::r--
other::r--
Another one is:
# file: ../www/info/2013-09-05/23.html
# owner: apache
# group: apache
user::rw-
group::r--
other::r--
# file: ../www/info/2013-09-05/16.html
# owner: apache
# group: apache
user::rw-
group::r--
other::r--
# file: ../www/info/2013-09-05/1.html
# owner: apache
# group: apache
user::rw-
group::r--
other::r--
How to make getfacl run with certain order?
回答1:
Iterate through the directory manually, using a loop or find call and then call getfacl on each file.
来源:https://stackoverflow.com/questions/61193088/how-to-make-getfacl-run-with-certain-order