On 2/14/24 12:06 AM, Oğuz wrote:
On Tuesday, February 13, 2024, Chet Ramey via austin-group-l at The Open Group <[email protected] <mailto:[email protected]>> wrote:

    `continue' is a builtin; continue has a return status; `!' says to
    negate it. It seems easy to come to the conclusion that the script
    should return 1.


The same can be said about `return'. But bash disagrees:

     $ bash -c 'f(){ ! return 1;}; f; echo $?'
     1
     $

Does POSIX allow this or is it another case where bash diverges from POSIX?

POSIX requires this, since it says that return sets $? to 1 here. If
you find cases where you believe bash differs from POSIX, and it's not
documented in POSIX mode, please report them.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/

  • sh 'continue... Thorsten Glaser via austin-group-l at The Open Group
    • Re: sh ... Chet Ramey via austin-group-l at The Open Group
      • Re:... Oğuz via austin-group-l at The Open Group
        • ... Harald van Dijk via austin-group-l at The Open Group
          • ... Oğuz via austin-group-l at The Open Group
            • ... Harald van Dijk via austin-group-l at The Open Group
              • ... Oğuz via austin-group-l at The Open Group
                • ... Harald van Dijk via austin-group-l at The Open Group
                • ... Oğuz via austin-group-l at The Open Group
                • ... Robert Elz via austin-group-l at The Open Group
        • ... Chet Ramey via austin-group-l at The Open Group
          • ... Christoph Anton Mitterer via austin-group-l at The Open Group
            • ... Chet Ramey via austin-group-l at The Open Group
          • ... Robert Elz via austin-group-l at The Open Group
            • ... Vincent Lefevre via austin-group-l at The Open Group
    • Re: sh ... Thorsten Glaser via austin-group-l at The Open Group
      • Re:... Harald van Dijk via austin-group-l at The Open Group
        • ... Harald van Dijk via austin-group-l at The Open Group
          • ... Oğuz via austin-group-l at The Open Group

Reply via email to