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-17 08:31 UTC ====================================================================== Summary: exit status of command substitution not properly specified ======================================================================
---------------------------------------------------------------------- (0003782) kre (reporter) - 2017-06-17 08:31 http://austingroupbugs.net/view.php?id=1150#c3782 ---------------------------------------------------------------------- Re 3781... It is actually quite explicit, re-read 2.9.1 (steps 1-4 in the prelude, and what immediately follows) and you will see it (should see it.) The shell takes the (unexpanded) command line, removes any words that are var-assigns (start with unquoted name= and precede any non-redirect word which does not start that way) and any redirect words (contain an unquoted redirect operator), then applies the expansion rules to all the words that are left. The result of this can have some words vanish (expand to nothing) and new words appear (file name expansion, field splitting). Once that is complete we look at what resulted, if they are any words it is some kind of command (function, built in, whatever), and is processed that way (and its exit status comes from the command - which can include the 126 and 127 exit codes from the shell attempting to execute the command.) If there were are no words remaining (either never were any, or they all vanished) then the rules for processing commandless redirections and variable expansions apply. In this case (and as stated at least, only in this case) does the exit status of the last executed command substitution (when the redirects and var-assigns are expanded, or possibly from the earlier word expansions) get used to set $? (the exit status of the empty command.) 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 2017-06-16 09:54 joerg Note Added: 0003769 2017-06-16 10:06 kre Note Added: 0003770 2017-06-16 10:16 joerg Note Added: 0003771 2017-06-16 10:21 joerg Note Edited: 0003771 2017-06-16 11:07 kre Note Added: 0003772 2017-06-16 15:38 stephane Note Added: 0003773 2017-06-16 15:52 joerg Note Added: 0003774 2017-06-16 15:59 joerg Note Edited: 0003774 2017-06-16 16:05 stephane Note Added: 0003775 2017-06-16 16:19 kre Note Added: 0003776 2017-06-16 16:33 shware_systems Note Added: 0003777 2017-06-16 16:35 kre Note Added: 0003778 2017-06-16 16:40 kre Note Added: 0003779 2017-06-16 16:43 kre Note Edited: 0003779 2017-06-16 16:45 joerg Note Added: 0003780 2017-06-16 16:45 joerg Note Edited: 0003780 2017-06-17 07:51 shware_systems Note Added: 0003781 2017-06-17 08:31 kre Note Added: 0003782 ======================================================================