[Toybox] is orthodoxy a strong value of toybox?

Chet Ramey chet.ramey at case.edu
Thu Sep 1 11:15:50 PDT 2022


On 9/1/22 1:24 PM, Rob Landley wrote:


> Hey Chet: why doesn't bash accept non-compound commands as functions? I have
> wondered. Apparently other shells disagree on this...?

Because the POSIX grammar says a function body is a compound command,
optionally followed by a redirection list, and I never saw the need to
extend that.

function_definition : fname '(' ')' linebreak function_body
                  ;
function_body    : compound_command                /* Apply rule 9 */
                  | compound_command redirect_list  /* Apply rule 9 */
                  ;

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



More information about the Toybox mailing list