Hi Hans,
Hans Schou <[email protected]> writes:
> In the tr man page and the --help command, a description of the '--'
> command is missing.
>
> In the info page it can be found where it says:
>
> However, when ‘-’ is one of those characters, it can be tricky
> because ‘-’ has special meanings. Performing the same task as
> above but also removing all ‘-’ characters, we might try ‘tr -d
> -axM’, but that would fail because ‘tr’ would try to interpret ‘-a’
> as a command-line option. Alternatively, we could try putting the
> hyphen inside the string, ‘tr -d a-xM’, but that wouldn’t work
> either because it would make ‘tr’ interpret ‘a-x’ as the range of
> characters ‘a’...‘x’ rather than the three. One way to solve the
> problem is to put the hyphen at the end of the list of characters:
>
> tr -d axM-
>
> Or you can use ‘--’ to terminate option processing:
>
> tr -d -- -axM
Yes, this applies to all programs. Though, with varying degrees of
impact. E.g., this one will not cause anyone trouble, unlike the case of
'tr' you mention:
$ env true --help | wc -l
18
$ env true -- --help | wc -l
0
I considered listing it near the --help and --version descriptions in
the --help output as a result of a separate report [1]. But I thought it
looked a bit strange.
Thanks,
Collin
[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79896