root@ubuntu:~# touch -abc.txt #直接创建文件则认为是参数,报错
touch: invalid option -- 'b'
Try 'touch --help' for more information.
root@ubuntu:~# touch '-abc.txt' #用单引号和转义符都失败
touch: invalid option -- 'b'
Try 'touch --help' for more information.
root@ubuntu:~# touch -- '-abc.txt' #在中间加上--就可以了
root@ubuntu:~# ls
-abc.txt snap
root@ubuntu:~# rm -- -abc.txt
root@ubuntu:~#
linux下以-开头的文件创建和删除方法
最新推荐文章于 2024-08-08 09:03:17 发布
本文介绍了在Ubuntu系统中使用touch命令创建文件时遇到的错误,如何正确使用单引号和选项,以及解决方法。通过实例展示了如何绕过无效参数错误并列出文件。
9402

被折叠的 条评论
为什么被折叠?



