coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: readlink: no mention of "--" option


From: Oliver Lange
Subject: Re: readlink: no mention of "--" option
Date: Mon, 8 Jan 2018 22:02:58 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

Am 08.01.2018 um 13:56 schrieb Eric Blake:
> On 01/07/2018 05:00 AM, Oliver Lange wrote:
>>
>> Hi everyone,
>>
>> Just wanted to mention that neither the --help msg nor the man page for
>> readlink mention the apparent support for the "--" option to stop
>> interpreting further args as possible command options.
> 
> Thanks for the report.  However, the use of '--' to end option arguments
> is required by POSIX to work for almost ALL applications (not just
> coreutils), so we haven't bothered to document it for individual
> applications, on the assumption that it is better to document that
> behavior at a system-wide level.  Any program that uses getopt() will
> obey that idiom, so the man page for getopt(3) is such a system-wide place.
> 
> You are correct that the coreutils.info document should mention the
> trick up front - and it does, in the "Common options" section 2:
> 
> ‘--help’
>      Print a usage message listing all available options, then exit
>      successfully.
> 
> ‘--version’
>      Print the version number, then exit successfully.
> 
> ‘--’
>      Delimit the option list.  Later arguments, if any, are treated as
>      operands even if they begin with ‘-’.  For example, ‘sort -- -r’
>      reads from the file named ‘-r’.
> 
> 
> I will note that there are a couple of POSIX-based exceptions for
> historical reasons; for example, 'echo' must NOT interpret '--' as end
> of options, and you are better off using 'printf' than 'echo' if you
> need to output a string that starts with a dash.
> 

Thank you very much for your detailed answer!

I suspected that you guys probably had a standard defined somewhere...
Maybe this helps someone else, too. Thanks again.

-- 

MfG,

Oliver Lange.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]