Name
name()
Synopsis
name
() {commands
; }
Define name as a function. POSIX syntax.
The function definition can be written on one line or across many.
You may also provide the function
keyword, an alternate form that works similarly. See the earlier
section Functions.
Example
$count ( ) {
>ls | wc -l
>}
When issued at the command line, count
now displays the number of files
in the current directory.
Get bash Quick Reference 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.