Ole*_*kiy 15
如果你在同一个系统上有/ etc的"正常"内容(比如安装在其他目录中,比方说/mnt/correct/etc),你可以使用--reference参数to chmod和chown命令,并将它与find从"普通"目录启动的那个结合起来:
$ cd /mnt/correct/etc
$ find . ! -type l -exec chown -v --reference='{}' /etc/'{}' \;
$ find . ! -type l -exec chmod -v --reference='{}' /etc/'{}' \;
Run Code Online (Sandbox Code Playgroud)
(我假设您使用的是具有GNU coreutils版本chmod和chown的UNIX系统.)
在"! -type l"病情find不包括符号链接,否则chmod将使用链接的权限来更改文件的链接点(和同样适用于chown).
| 归档时间: |
|
| 查看次数: |
4027 次 |
| 最近记录: |