A NOTE has been added to this issue. 
====================================================================== 
http://austingroupbugs.net/view.php?id=1150 
====================================================================== 
Reported By:                kre
Assigned To:                
====================================================================== 
Project:                    1003.1(2016)/Issue7+TC2
Issue ID:                   1150
Category:                   Shell and Utilities
Type:                       Omission
Severity:                   Editorial
Priority:                   normal
Status:                     New
Name:                       Robert Elz 
Organization:                
User Reference:              
Section:                    2.6.3 
Page Number:                2357 - 2358 
Line Number:                75182 - 75224 
Interp Status:              --- 
Final Accepted Text:         
====================================================================== 
Date Submitted:             2017-06-16 01:33 UTC
Last Modified:              2017-06-16 09:38 UTC
====================================================================== 
Summary:                    exit status of command substitution not properly
specified
====================================================================== 

---------------------------------------------------------------------- 
 (0003768) joerg (reporter) - 2017-06-16 09:38
 http://austingroupbugs.net/view.php?id=1150#c3768 
---------------------------------------------------------------------- 
The standard is obvious here:

If return or exit are called without parameter, the return/exit status
is the status of the last command executed.

Given that with "return $(exit 1)", the last command executed
was "exit 1", it seems to be obvious that the expected return value is 1.

This is important as we like to have an orthogonal behavior and:

sh -c 'FOO=$(exit 99);  echo $?'

is expected to print 99 while

sh -c 'FOO=$(exit 99) :;  echo $?'

is expected to print 0 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2017-06-16 01:33 kre            New Issue                                    
2017-06-16 01:33 kre            Name                      => Robert Elz      
2017-06-16 01:33 kre            Section                   => 2.6.3           
2017-06-16 01:33 kre            Page Number               => 2357 - 2358     
2017-06-16 01:33 kre            Line Number               => 75182 - 75224   
2017-06-16 01:46 kre            Note Added: 0003766                          
2017-06-16 06:10 stephane       Note Added: 0003767                          
2017-06-16 09:38 joerg          Note Added: 0003768                          
======================================================================


Reply via email to