mv,rm等命令出现unrecognized option提示的解决方法

Posted codeking100

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mv,rm等命令出现unrecognized option提示的解决方法相关的知识,希望对你有一定的参考价值。

出现这个提示,一般是由于命令操作的文件名最前面有"--"字符, 让命令误以为是--开头的长选项

 

解决: 命令后加上"--", shell把 -- 之后的参数当做文件名来对待 禁止把-filename当做参数选项来解释

eg:

$ touch --a.txt
touch: unrecognized option ‘--a.txt‘
Try ‘touch --help‘ for more information.
$ touch -- --a.txt

 

$ mv --a.txt --b.txt
mv: unrecognized option ‘--a.txt‘
Try ‘mv --help‘ for more information.
$ mv -- --a.txt --b.txt

 







以上是关于mv,rm等命令出现unrecognized option提示的解决方法的主要内容,如果未能解决你的问题,请参考以下文章