希望有人可以帮助这个:
尝试使用此命令删除/ 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 {} \;