Functions

A shell function is similar to a shell script, storing a series of commands for execution at a later time. However, because the shell stores a function in the computer's main memory (RAM) instead of in a file on the disk, you can access it more quickly than you can access a script. Also, the shell preprocesses (parses) a function so that it starts up more quickly than a script. Finally, the shell executes a shell function in the same shell that called it.

You can declare a shell function in your .bash_profile file, in the script that uses it, or directly from the command line. You can remove functions with the unset builtin . The shell ...

Get A Practical Guide to Red Hat® Linux® 8 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.