linux – -maxdepth选项后不能选择AND find:path必须先于表达式

linux – -maxdepth选项后不能选择AND find:path必须先于表达式,第1张

概述希望有人可以帮助这个: 尝试使用此命令删除/ tmp上的会话文件: find /tmp -name 'sess_*' -user Username -maxdepth 1 $CMD {} \; 但是我收到以下错误: find: warning: you have specified the -maxdepth option after a non-option argument -name, bu 希望有人可以帮助这个:

尝试使用此命令删除/ tmp上的会话文件:

find /tmp -name 'sess_*' -user Username -maxdepth 1 $CMD {} \;

但是我收到以下错误:

find: warning: you have specifIEd the -maxdepth option after a
non-option argument -name,but options are not positional (-maxdepth
affects tests specifIEd before it as well as those specifIEd after
it). Please specify options before other arguments.

06001

我通过网络寻找解决方案,但找不到任何解决方案.我已经删除其他tmp文件与其他命令,并怀疑是否影响一些卷或套接字.

先谢谢你

解决方法 find有三种类型的选项:用于匹配文件的选项(例如-name,-user),指定在匹配文件(-print,-exec)上执行的 *** 作的选项以及控制整个行为的选项命令(例如-maxdepth,-xdev).第三种必须放在另外两种之前.所以应该是:
find /tmp -maxdepth 1 -name 'sess_*' -user Username -exec $CMD {} \;
总结

以上是内存溢出为你收集整理的linux – -maxdepth选项后不能选择AND find:path必须先于表达式全部内容,希望文章能够帮你解决linux – -maxdepth选项后不能选择AND find:path必须先于表达式所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1045287.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存