GNU bug report logs - #19604
echo --help does not work

Previous Next

Package: coreutils;

Reported by: prateek goyal <prateek.goyal5 <at> gmail.com>

Date: Thu, 15 Jan 2015 07:06:01 UTC

Severity: normal

Tags: notabug

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 19604 in the body.
You can then email your comments to 19604 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#19604; Package coreutils. (Thu, 15 Jan 2015 07:06:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to prateek goyal <prateek.goyal5 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 15 Jan 2015 07:06:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: prateek goyal <prateek.goyal5 <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: echo --help does not work
Date: Thu, 15 Jan 2015 11:50:34 +0530
[Message part 1 (text/plain, inline)]
Hi,


when I try to use --help option with echo command, it does not print help
contents, but prints "--help".


prateek <at> prateek-pc:~/Documents/awk$ echo --help
--help


Version and OS:

Linux prateek-pc 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC
2014 x86_64 x86_64 x86_64 GNU/Linux


-- 

*Thanks,Prateek Goyal*
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#19604; Package coreutils. (Thu, 15 Jan 2015 11:37:02 GMT) Full text and rfc822 format available.

Message #8 received at 19604 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: prateek goyal <prateek.goyal5 <at> gmail.com>, 19604 <at> debbugs.gnu.org
Subject: Re: bug#19604: echo --help does not work
Date: Thu, 15 Jan 2015 11:36:32 +0000
tag 19604 notabug
close 19604
stop

On 15/01/15 06:20, prateek goyal wrote:
> Hi,
> 
> 
> when I try to use --help option with echo command, it does not print help contents, but prints "--help".
> 
> 
> prateek <at> prateek-pc:~/Documents/awk$ echo --help
> --help

You're actually using your shell's echo there.
To use the coreutils one:

  env echo --help

To invoke help for the shell builtin in bash you:

  help echo

Note newer versions of bash will support $builtin --help,
though I've not tested the echo case which would
introduce a change in behavior.

thanks,
Pádraig.





Added tag(s) notabug. Request was from Pádraig Brady <P <at> draigBrady.com> to control <at> debbugs.gnu.org. (Thu, 15 Jan 2015 11:37:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 19604 <at> debbugs.gnu.org and prateek goyal <prateek.goyal5 <at> gmail.com> Request was from Pádraig Brady <P <at> draigBrady.com> to control <at> debbugs.gnu.org. (Thu, 15 Jan 2015 11:37:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#19604; Package coreutils. (Thu, 15 Jan 2015 14:10:02 GMT) Full text and rfc822 format available.

Message #15 received at 19604 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Pádraig Brady <P <at> draigBrady.com>,
 prateek goyal <prateek.goyal5 <at> gmail.com>, 19604 <at> debbugs.gnu.org
Subject: Re: bug#19604: echo --help does not work
Date: Thu, 15 Jan 2015 07:09:18 -0700
[Message part 1 (text/plain, inline)]
On 01/15/2015 04:36 AM, Pádraig Brady wrote:
> tag 19604 notabug
> close 19604
> stop
> 
> On 15/01/15 06:20, prateek goyal wrote:
>> Hi,
>>
>>
>> when I try to use --help option with echo command, it does not print help contents, but prints "--help".
>>
>>
>> prateek <at> prateek-pc:~/Documents/awk$ echo --help
>> --help
> 
> You're actually using your shell's echo there.
> To use the coreutils one:
> 
>   env echo --help

Furthermore, the behavior you saw in your shell is required by POSIX.
If you do 'env POSIXLY_CORRECT=1 echo --help', you will get the same
behavior from coreutils as you did from your shell.  'echo' is one of
the few utilities that _cannot_ honor --help for compatibility reasons.


> Note newer versions of bash will support $builtin --help,
> though I've not tested the echo case which would
> introduce a change in behavior.

If bash changes the behavior of 'echo --help' in POSIX mode, then that
would be a bug in bash.

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

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

Information forwarded to bug-coreutils <at> gnu.org:
bug#19604; Package coreutils. (Thu, 15 Jan 2015 15:56:02 GMT) Full text and rfc822 format available.

Message #18 received at 19604 <at> debbugs.gnu.org (full text, mbox):

From: prateek goyal <prateek.goyal5 <at> gmail.com>
To: Eric Blake <eblake <at> redhat.com>
Cc: 19604 <at> debbugs.gnu.org, Pádraig Brady <P <at> draigbrady.com>
Subject: Re: bug#19604: echo --help does not work
Date: Thu, 15 Jan 2015 21:25:51 +0530
[Message part 1 (text/plain, inline)]
So even if I execute following command, it gives same result:

env POSIXLY_CORRECT=1 echo --help

prateek <at> prateek-pc:~/Documents/awk$ env POSIXLY_CORRECT=1 echo --help
--help

Thanks,
prateek

On 15 January 2015 at 19:39, Eric Blake <eblake <at> redhat.com> wrote:

> On 01/15/2015 04:36 AM, Pádraig Brady wrote:
> > tag 19604 notabug
> > close 19604
> > stop
> >
> > On 15/01/15 06:20, prateek goyal wrote:
> >> Hi,
> >>
> >>
> >> when I try to use --help option with echo command, it does not print
> help contents, but prints "--help".
> >>
> >>
> >> prateek <at> prateek-pc:~/Documents/awk$ echo --help
> >> --help
> >
> > You're actually using your shell's echo there.
> > To use the coreutils one:
> >
> >   env echo --help
>
> Furthermore, the behavior you saw in your shell is required by POSIX.
> If you do 'env POSIXLY_CORRECT=1 echo --help', you will get the same
> behavior from coreutils as you did from your shell.  'echo' is one of
> the few utilities that _cannot_ honor --help for compatibility reasons.
>
>
> > Note newer versions of bash will support $builtin --help,
> > though I've not tested the echo case which would
> > introduce a change in behavior.
>
> If bash changes the behavior of 'echo --help' in POSIX mode, then that
> would be a bug in bash.
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>


-- 

*Thanks,Prateek Goyal*
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#19604; Package coreutils. (Fri, 16 Jan 2015 09:50:02 GMT) Full text and rfc822 format available.

Message #21 received at 19604 <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: prateek goyal <prateek.goyal5 <at> gmail.com>, Eric Blake <eblake <at> redhat.com>
Cc: 19604 <at> debbugs.gnu.org, Pádraig Brady <P <at> draigbrady.com>
Subject: Re: bug#19604: echo --help does not work
Date: Fri, 16 Jan 2015 10:49:06 +0100
On 01/15/2015 04:55 PM, prateek goyal wrote:
> So even if I execute following command, it gives same result:

> prateek <at> prateek-pc:~/Documents/awk$ env POSIXLY_CORRECT=1 echo --help
> --help

That is exactly what Eric said before: POSIX mandates to literally
output the string "--help" - which coreutils' echo does if the variable
POSIXLY_CORRECT is set.  Otherwise, the implementation extends the
functionality and adheres to GNU standards which mandates to honor
the "--help" option to output the usage message:

  $ env --unset=POSIXLY_CORRECT echo --help
  Usage: ...

Maybe you were confused by the use of the 'env' utility.
You'll get the same by specifying the echo with it's absolute path:

  $ which echo
  /usr/bin/echo
  $ unset POSIXLY_CORRECT
  $ /usr/bin/echo --help
  Usage: [...]

Have a nice day,
Berny




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 13 Feb 2015 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 130 days ago.

Previous Next


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