简体   繁体   English

xarg,find和rm rm:无法删除`./not':没有这样的文件或目录

[英]xarg, find and rm rm: cannot remove `./not': No such file or directory

I am following this Wikipedia example to find and remove a file. 我正在按照这个Wikipedia示例查找和删除文件。

[jalal@galapagos-04] (5)$ touch 'not important_file'
[jalal@galapagos-04] (6)$ touch important_file
[jalal@galapagos-04] (7)$ ls
agreement.txt    cs_web          johns.txt            reverse_sorted_user.txt  songs.txt        users.txt*
awk_example.txt  good_users.txt  marks.txt            sed_example.txt          sorted_user.txt
cs.html          important_file  not\ important_file  softlink/                test@
[jalal@galapagos-04] (8)$ find . -name not\* | tail -1 | xargs rm
rm: cannot remove `./not': No such file or directory

Any idea how could this be fixed? 知道如何解决吗?

The xargs article you link to discusses in detail how using null or line-terminated processing is needed to handle these exact situations, but you're not even using xargs . 您链接到的xargs文章详细讨论了如何使用空值或行终止处理来处理这些确切情况,但是您甚至没有使用xargs

You've copied an example that's mean to illustrate something that doesn't work. 您已经复制了一个示例,该示例旨在说明无效的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM