假设Linux/Unix系统中有一个文件名叫“-target”,如果我们想对它进行操作,例如要删除它按照一般的删除方法在命令行中输入rm -target命令,界面会提示我们是“无效选项”(invalid option)
原来由于文件名的第一个字符为“-”,Linux/Unix把文件名当作选项了。我们可以使用“--”符号来解决这个问题,通过man rm可以知道
A - permits the user to mark explicitly the end of any com-
mand line options, allowing rm to recognize file arguments
that begin with a -. As an aid to BSD migration, rm will
accept -- as a synonym for -. This migration aid may disap-
pear in a future release. If a -- and a - both appear on the
same command line, the second will be interpreted as a file.
...
阅读全文...