Las funciones en bash
se denominan esencialmente comandos compuestos (o bloques de código). De man bash
:
Compound Commands
A compound command is one of the following:
...
{ list; }
list is simply executed in the current shell environment. list
must be terminated with a newline or semicolon. This is known
as a group command.
...
Shell Function Definitions
A shell function is an object that is called like a simple command and
executes a compound command with a new set of positional parameters.
... [C]ommand is usually a list of commands between { and }, but
may be any command listed under Compound Commands above.
No se da ninguna razón, es solo la sintaxis.
Dado que la lista en la función de una línea dada no termina con una nueva línea o una ;
, se bash
queja.