On Fri, Sep 19, 2025 at 11:40:51AM +0200, pourko--- via Bug reports for the GNU 
Bourne Again SHell wrote:
> Wouldn't it be more reasonable to return 0 when invoking 
>   builtin_name --help
> the way most external commands do?
> (Unless there's actually an error.)
> 

Playing the devil's advocate here...at least in part.

The bug here seems to be that the "--help" long option provokes a
behaviour from some built-ins that is not documented.  The built-ins
that do this are rightly exiting with status 2, since an invalid option
was given, but the fact that they *also* output help text seems like a
bug to me.  To get the help text, one should use "help builtin_name"
(this also works for built-ins like "[" and "echo" that do not recognize
"--help").  This is the point of the "help" built-in.

-- 
Matti Andreas Kähäri
Uppsala, Sweden

.

  • builtin_name --he... pourko--- via Bug reports for the GNU Bourne Again SHell
    • Re: builtin_... Andreas Kähäri
      • Re: buil... pourko--- via Bug reports for the GNU Bourne Again SHell
        • Re: ... Chet Ramey
          • ... pourko--- via Bug reports for the GNU Bourne Again SHell
            • ... Chet Ramey
              • ... pourko--- via Bug reports for the GNU Bourne Again SHell
                • ... Chet Ramey
                • ... pourko--- via Bug reports for the GNU Bourne Again SHell
                • ... Chet Ramey
                • ... Andreas Kähäri
        • Re: ... Andreas Kähäri

Reply via email to