On Sun, 17 Nov 2024, Klemens Nanni wrote:
> 17.11.2024 22:49, George Koehler пишет:
> > On Sun, 17 Nov 2024 19:10:30 +0000
> > Klemens Nanni <k...@openbsd.org> wrote:
> > 
> >> 17.11.2024 20:25, Andreas Kähäri пишет:
> >>> A the final right curly brace of a compound command must be preceeded by
> >>> a command terminator
> >>
> >> Not always:
> >>
> >>    $ f() {} ; typeset -f f
> >>    f() {}
> > 
> > That isn't a compound command,
> > 
> >     $ f() {}; f
> >     ksh: {}: not found
> > 
> > It's a single command, like
> > 
> >     $ f() uname; f
> >     OpenBSD
> > 
> > To make a compound command, the { and } must be the first word of
> > a command; {} is a different word.
> 
> Ah, spaces between { and } are significant.
> 
> So is this a compound command?  Looks like one:
> 
>       $ f() { }; typeset -f f
>       f() {
>           
>       }

Yes, of course: close-brace is only recognized as a reserved word when in 
the position to be recognized as the first word of a command, but the 
token after a reserved word except 'case', 'for', or 'in' (but including 
open-brace) is in such a position.  So yes, { } is a valid compound 
command.  (XCU 2.4 Reserved Words)

Reply via email to