Name
name ()
Synopsis
name
() {commands
; }
Define name as a function. POSIX
syntax. The function definition can be written on one line or
across many. Bash and the Korn shell provide the function
keyword, alternate forms that
work 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 Unix in a Nutshell, 4th 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.