< Day Day Up > 

A builtin is a utility (also called a command) that is built into a shell. Each of the shells has its own set of builtins. When it runs a builtin, the shell does not fork a new process. Consequently builtins run more quickly and can affect the environment of the current shell. Because builtins are used in the same way as utilities, you will not typically be aware of whether a utility is built into the shell or is a stand-alone utility.

The echo utility is a shell builtin. The shell always executes a shell builtin before trying to find a command or utility with the same name. See page 487 for an in-depth discussion of builtin commands, page 500 for a list of bash builtins, and page 377 for a list of tcsh builtins.

Listing bash builtins

To get a complete list of bash builtins, give the command info bash builtin. To display a page with more information on each builtin, move the cursor to one of the lines listing a builtin command and press RETURN. Alternatively, after typing info bash, give the command /builtin to search the bash documentation for the string builtin. The cursor will rest on the word Builtin in a menu; press RETURN to display the builtins menu.

Because bash was written by GNU, the info page has better information than does the man page. If you want to read about builtins in the man page, give the command man bash and then search for the section on builtins with the command /^SHELL BUILTIN COMMANDS (search for a line that begins with SHELL . . .).

Listing tcsh builtins

For tcsh, give the command man tcsh to display the tcsh man page and then search for the second occurrence of Builtin commands with the following two commands: /Builtin commands (search for the string) and n (search for the next occurrence of the string).

     < Day Day Up > 

    A Practical Guide to LinuxR Commands, Editors, and Shell Programming
    A Practical Guide to LinuxR Commands, Editors, and Shell Programming
    ISBN: 131478230
    EAN: N/A
    Year: 2005
    Pages: 213

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net