rm无法删除以“-"开头的文件. [英] rm cannot delete files starting with "--"
本文介绍了rm无法删除以“-"开头的文件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个创建文件的脚本,有时它们在开始时会有两个破折号.有什么办法可以删除它们? mv
也不起作用.
I have a script that creates files, and sometimes they end up having two dashes at the beginning. Is there any way to delete them? mv
doesn't work either.
这是我遇到的错误:
$ ls
--1355509766.jpg
$ rm --1355509766.jpg
rm: illegal option -- -
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
$ rm "--1355509766.jpg"
rm: illegal option -- -
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
推荐答案
通常的技巧是
rm ./--1355509766.jpg
更新:这是man rm
对此要说的:
Update: here's what man rm
has to say about this:
To remove a file whose name starts with a '-', for example '-foo', use
one of these commands:
rm -- -foo
rm ./-foo
这篇关于rm无法删除以“-"开头的文件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文