GNU bug report logs - #21416
"--" syntax for ignoring flags doesn't seem to work right with GNU /bin/echo

Previous Next

Package: coreutils;

Reported by: "Robert \"Finny\" Merrill" <rfm <at> arista.com>

Date: Fri, 4 Sep 2015 19:11:02 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eric Blake <eblake <at> redhat.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#21416: closed ("--" syntax for ignoring flags doesn't seem to
 work right with GNU /bin/echo)
Date: Fri, 04 Sep 2015 19:27:03 +0000
[Message part 1 (text/plain, inline)]
Your message dated Fri, 4 Sep 2015 13:26:42 -0600
with message-id <55E9F072.4070009 <at> redhat.com>
and subject line Re: bug#21416: "--" syntax for ignoring flags doesn't seem to work right with GNU /bin/echo
has caused the debbugs.gnu.org bug report #21416,
regarding "--" syntax for ignoring flags doesn't seem to work right with GNU /bin/echo
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
21416: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21416
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: "Robert \"Finny\" Merrill" <rfm <at> arista.com>
To: bug-coreutils <at> gnu.org
Subject: "--" syntax for ignoring flags doesn't seem to work right with GNU
 /bin/echo
Date: Fri, 4 Sep 2015 11:57:30 -0700
~/workspaces/diags-dev/s1 @bs360.sjc> /bin/echo --help
Usage: /bin/echo [SHORT-OPTION]... [STRING]...
  or:  /bin/echo LONG-OPTION
Echo the STRING(s) to standard output.
*snip*
~/workspaces/diags-dev/s1 @bs360.sjc> /bin/echo -- --help
-- --help
~/workspaces/diags-dev/s1 @bs360.sjc>


There doesn't seem to be a way to get /bin/echo to output the string "--help"


[Message part 3 (message/rfc822, inline)]
From: Eric Blake <eblake <at> redhat.com>
To: "Robert \"Finny\" Merrill" <rfm <at> arista.com>, 21416-done <at> debbugs.gnu.org
Subject: Re: bug#21416: "--" syntax for ignoring flags doesn't seem to work
 right with GNU /bin/echo
Date: Fri, 4 Sep 2015 13:26:42 -0600
[Message part 4 (text/plain, inline)]
tag 21416 notabug
thanks

On 09/04/2015 12:57 PM, Robert "Finny" Merrill wrote:
> ~/workspaces/diags-dev/s1 @bs360.sjc> /bin/echo --help
> Usage: /bin/echo [SHORT-OPTION]... [STRING]...
>   or:  /bin/echo LONG-OPTION
> Echo the STRING(s) to standard output.
> *snip*

This is a GNU extension; it is not POSIX compliant, but can easily be
overridden, as shown below.

> ~/workspaces/diags-dev/s1 @bs360.sjc> /bin/echo -- --help
> -- --help

Thanks for the report. However, this is working as required by POSIX:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html

    "The echo utility shall not recognize the "--" argument in the
manner specified by Guideline 10 of XBD Utility Syntax Guidelines; "--"
shall be recognized as a string operand."

    "Implementations shall not support any options."

> 
> There doesn't seem to be a way to get /bin/echo to output the string "--help"

Ah, but there is:

$ POSIXLY_CORRECT=1 /bin/echo --help
--help

Also, POSIX says that 'echo' is outdated (not only because it violates
the standard syntax rules, but also because it has non-portable handling
of \), and that you should strongly consider using printf, in which
case, you would do:

$ printf -- %s\\n --help
--help

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 9 years and 265 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.