SYNOPSIS
command
[
command [
builtin builtin-name [argument ...]
DESCRIPTION
command causes the KornShell to suppress its function lookup and execute the given command-name and arguments as though they made up a standard command line. In most cases, if command-name is not the name of a function the results are the same as omitting command. If, however, command-name is a special built-in utility (see sh), some unique properties of special built-ins do not apply:
- A syntax error in the utility does not cause the shell executing the utility to abort.
- Variable assignments specified with the special built-in utility do not remain in effect after the shell has executed the utility.
The builtin utility is similar to command except that it takes no options and only works for executing shell built-in utilities.
Options
-p -
searches for command-name using the default system PATH.
-V -
writes a string indicating how the shell interprets command-name. If command-name is a utility, regular built-in utility or an implementation-provided function found using the PATH variable, the string identifies it as such and includes the absolute path name. If command-name is an alias, function, special built-in utility or reserved word, the string identifies it as such and includes its definition if it is an alias.
-v -
writes a string indicating the path name or command that the shell uses to invoke command-name.
EXAMPLES
Typically, you use command when you have a command that may have the same name as a function. For example, here's a definition of a cd function that not only switches to a new directory, but also uses ls to list the contents of that directory.
function cd { command cd $1 ls -F }
This function uses command to get at the real cd. If this was not done, the cd function would call itself in an infinite recursion.
ENVIRONMENT VARIABLES
- PATH
-
contains a list of directories for command to use when searching for command-name except as described under the
-p option.
DIAGNOSTICS
If you specified
- 0
-
Successful completion.
- 1
-
command was unable to find command-name or an error occurred.
- 2
-
Failure due to invalid command line argument.
If you did not specify
- 126
-
command found command-name, but failed to invoke it.
- 127
-
An error occurred in the command utility or it was unable to find command-name.
Otherwise, the exit status of command is the exit status of command-name.
Possible exit status values for builtin are:
- 0
-
The specified shell built-in command was executed and completed successfully.
- >0
-
The specified builtin-name was either not a shell built-in or an error occurred in its execution. In the latter case, builtin returns the exit status of the specified shell built-in command.
PORTABILITY
POSIX.2. x/OPEN Portability Guide 4.0. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022. Windows Server 2025.
The UNIX Korn Shell version of builtin features additional functionality. The PTC MKS Toolkit version is compatible with UNIX bash.
NOTE
The command and builtin commands are built into the MKS KornShell.
AVAILABILITY
PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC Windchill Requirements and Validation
SEE ALSO
- Commands:
- sh
PTC MKS Toolkit 10.5 Documentation Build 40.