-EXEC选项查找命令在Ubuntu上无法正常工作
我正在对查找命令进行一些练习,但是当我尝试使用-Exec
选项时,我没有得到预期的结果。我编写的命令只能在没有-exec
选项的情况下使用以下内容:
$ find ~ \( -type f -not -perm 0600 \) -or \( -type d -name 'D*' \)
/home/baki/.bashrc
/home/baki/.bash_logout
/home/baki/.cache/motd.legal-displayed
/home/baki/.config/wslu/baseexec
/home/baki/.config/wslu/oemcp
/home/baki/.gitconfig
/home/baki/.landscape/sysinfo.log
/home/baki/.motd_shown
/home/baki/.profile
/home/baki/.ssh/known_hosts
/home/baki/.sudo_as_admin_successful
/home/baki/ssh_start
/home/baki/token
但是,当我将-exec
选项添加到命令末尾时,它不会给出任何输出:
find ~ \( -type f -not -perm 0600 \) -or \( -type d -name 'D*' \) -exec ls -l '{}' ';'
我已经搜索过它,但是找不到可以解决我的问题的有用信息。
我的命令是错误的还是其他事情?
感谢您的帮助。
I am doing some practice on find command but I don't get the expected result when I attempt to use -exec
option of it. The command I wrote just works without -exec
option as the following:
$ find ~ \( -type f -not -perm 0600 \) -or \( -type d -name 'D*' \)
/home/baki/.bashrc
/home/baki/.bash_logout
/home/baki/.cache/motd.legal-displayed
/home/baki/.config/wslu/baseexec
/home/baki/.config/wslu/oemcp
/home/baki/.gitconfig
/home/baki/.landscape/sysinfo.log
/home/baki/.motd_shown
/home/baki/.profile
/home/baki/.ssh/known_hosts
/home/baki/.sudo_as_admin_successful
/home/baki/ssh_start
/home/baki/token
However, when I add the -exec
option to the end of the command, it doesn't give any output:
find ~ \( -type f -not -perm 0600 \) -or \( -type d -name 'D*' \) -exec ls -l '{}' ';'
I have searched about it but I couldn't find a piece of useful information that can solve my problem.
Is my command wrong or is it about something else?
Thank you for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
默认
和
操作的优先级高于-or
。使用额外的括号:在这种情况下,您可能可以省略内括号。
The default
-and
operation has higher precedence than-or
. Use extra parentheses:You can probably omit the inner parentheses in this case.