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

 

posted @ 2019-01-22 20:56  leo21sun  阅读(6805)  评论(0编辑  收藏  举报