builtin - Unix, Linux Command


Advertisements


NAME

builtin - To run a shell builtin, passing it args, and to get its exit status.

SYNOPSIS

builtin [shell-builtin [args]]

DESCRIPTION

builtin command is useful to define a shell function with the same name as a shell builtin, retaining the functionality of the builtin within the function.

EXAMPLES

Create a function to replace 'cd' command to write the hostname and current directory to an xterm title bar.

#builtinsample

/* first we define the function */
define cd(){
   builtin cd "$@"
}

/* then use the function to change directory*/
cd()

Run the utility

$ chmod a+x builtinsample
$ ./builtinsample

$ pwd
/root


Advertisements