O'Reilly logo

Classic Shell Scripting by Nelson H. F. Beebe, Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Built-in Commands

The shell has a number of commands that are built-in. This means that the shell itself executes the command, instead of running an external program in a separate process. Furthermore, POSIX distinguishes between "special" built-ins and "regular" built-ins. The built-in commands are listed in Table 7-9. Special built-ins are marked with a †. Most of the regular built-ins listed here have to be built-in for the shell to function correctly (e.g., read). Others are typically built into the shell only for efficiency (e.g., true and false). The standard allows other commands to be built-in for efficiency as well, but all regular built-ins must be accessible as separate programs that can be executed directly by other binary programs. test is a primary example of a command that often is built into the shell for efficiency reasons.

Table 7-9. POSIX shell built-in commands

Command

Summary

: (colon)[6]

Do nothing (just do expansions of arguments).

. (dot)

Read file and execute its contents in current shell.

alias

Set up shorthand for command or command line (interactive use).

bg

Put job in background (interactive use).

breaka

Exit from surrounding for, while, or until loop.

cd

Change working directory.

command

Locate built-in and external commands; find a built-in command instead of an identically named function.

continuea

Skip to next iteration of for, while, or until loop.

evala

Process arguments as a command line.

execa

Replace shell with given program or ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required