首页 > 系统服务 > 详细

linux 删除特殊文件名的文件

时间:2016-03-28 10:25:25      阅读:333      评论:0      收藏:0      [点我收藏+]

最近不小心touch文件时候,在文件名前面加了个短杠-,导致文件名类似于 -test.log 。

这样的话,按照常规的执行 rm -f ‘-test.log‘ 删除文件的时候,就会报错。类似如下:

rm: invalid option -- ‘t‘
Try ‘rm ./-test.log‘ to remove the file ‘-test.log’.>
Try ‘rm --help‘ for more information.


google了下,发现是因为linux将 横杠‘-’ 当成了命令选项了,我们只要执行 rm -- ‘-test.log‘ 即可正常删除该文件。

linux 删除特殊文件名的文件

原文:http://lee90.blog.51cto.com/10414478/1757416

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!