Name

name ( )

Synopsis

[function] name (  ) {commands; }

Define name as a function. POSIX syntax. The reserved word function is optional. The function definition can be written on one line or across many. See Functions in Functions for more detailed information.

Example

$ count (  ) {
> ls | wc -l
> }

When issued at the command line, count displays the number of files in the current directory.

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.