bash – 如何删除名称以’ – ‘开头的文件[复制]

参见英文答案 > How to remove files starting with double hyphen?7个
> rm cannot delete files starting with — 3个
在脚本出错后,我最终得到了一个名称以短划线’ – ‘开头的文件

-myfile.txt

我到目前为止尝试过:

rm -myfile.txt
rm: illegal option -- m
usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file

rm "-myfile.txt"
rm: illegal option -- m
usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file

rm "\-myfile.txt"
rm: \-myfile.txt: No such file or directory

rm \-myfile.txt
rm: illegal option -- m
usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file

rm "-"myfile.txt
rm: illegal option -- m
usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file

你有什么主意吗 ?

谢谢

感谢@ ajp15243:
答案是 :
rm ./-myfile.txt

要么

rm -- -myfile.txt

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...