搞错了,应该是getopt(3). getopt(1)是util-linux里的一个程序,getopt(3)才是POSIX函数。关于"--"的描述getopt(3)是这么说的。
By default, getopt() permutes the contents of argv as it scans, so that
eventually all the nonoptions are at the end. Two other scanning modes
are also implemented. If the first character of optstring is '+' or
the environment variable POSIXLY_CORRECT is set, then option processing
stops as soon as a nonoption argument is encountered. If the first
character of optstring is '-', then each nonoption argv-element is han‐
dled as if it were the argument of an option with character code 1.
(This is used by programs that were written to expect options and other
argv-elements in any order and that care about the ordering of the
two.) The special argument "--" forces an end of option-scanning re‐
gardless of the scanning mode.
【 在 gnwd (gnwd) 的大作中提到: 】
: 牛
: #发自zSMTH@Redmi K20 Pro Premium Edition
--
FROM 103.90.178.*