- 论坛徽章:
- 0
|
如何操作以横线“-”开头的文件
如何操作以横线“-”开头的文件名
在查看 rm 的 man 手册时有这么一行提示:
QUOTE:
To remove a file whose name starts with a ‘-’, for example ‘-foo’, use one of these commands:
rm -- -foo
rm ./-foo
也就是说,如果要删除一个文件 -foo ,用一般的 rm 命令是完成不了的。 rm -foo 、 rm \-foo 、 rm "-foo" 、 rm "\-foo" …… 都无法将此文件删除,只能通过 rm -- -foo 或者 rm ./-foo 的方式删除
同样此方法对于其它命令都是通用的
vi -- -c 将生成一个 -c 文件
ls -l -- -c 将显示 -c 文件
转载:http://zhoulifa.9999mb.com/bbs/viewthread.php?tid=20&extra=page%3D1
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/25799/showart_195700.html |
|