Fungsi pada bash
dasarnya adalah perintah gabungan (atau blok kode). Dari 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.
Tidak ada alasan yang diberikan, itu hanya sintaks.
Karena daftar dalam fungsi satu baris yang diberikan tidak diakhiri dengan baris baru atau ;
, bash
komplain.