假如不小心生产了一个文件名为中划线起头的文件,如何删除;
比如下面的文件,会生成一个 '-s’文件;
./strace -f -o -s 2048 smad.out -p 2927
如果直接写这个 -s文件,会被认为是rm的一个选项。从而出现错误。
[root@qrms6-host01 ~]# rm -rf “-s”
rm: invalid option – ‘s’
Try ‘rm ./-s’ to remove the file ‘-s’.
Try ‘rm --help’ for more information.
[root@qrms6-host01 ~]# rm -rf – -s^C
[root@qrms6-host01 ~]# rm -s
rm: invalid option – ‘s’
Try ‘rm ./-s’ to remove the file ‘-s’.
Try ‘rm --help’ for more information.
[root@qrms6-host01 ~]# rm ‘-s’
rm: invalid option – ‘s’
Try ‘rm ./-s’ to remove the file ‘-s’.
Try ‘rm --help’ for more information.
可以使用 两个中划线抵消这个选项认定:
[root@qrms6-host01 ~]# rm – ‘-s’
rm: remove regular empty file ‘-s’? y