If the command_name is the same as the name of one of the special built-in utilities, the special properties will not occur. In every other respect, if command_name is not the name of a function, the effect of command will be the same as omitting command.
The command utility also provides information concerning how a command name will be interpreted by the shell; see -v and -V.
- Utilities, regular built-in utilities, command_names including a slash character, and any implementation-provided functions that are found using the PATH variable will be written as absolute path names.
- Shell functions, special built-in utilities, regular built-in utilities not associated with a PATH search, and shell reserved words will be written as just their names.
- An alias will be written as a command line that represents its alias definition.
- Otherwise, no output will be written and the exit status will reflect that the name was not found.
- Utilities, regular built-in utilities, and any implementation-provided functions that are found using the PATH variable will be identified as such and include the absolute path name in the string.
- Other shell functions will be identified as functions.
- Aliases will be identified as aliases and their definitions will be included in the string.
- Special built-in utilities will be identified as special built-in utilities.
- Regular built-in utilities not associated with a PATH search will be identified as regular built-in utilities.
- Shell reserved words will be identified as reserved words.
cd() { command cd "$@" >/dev/null pwd }
IFS=’ ’ # The preceding value should be <space><tab><newline>. # Set IFS to its default value. \unalias -a # Unset all possible aliases. # Note that unalias is escaped to prevent an alias # being used for unalias. unset -f command # Ensure command is not a user function. PATH="$(command -p getconf _CS_PATH):$PATH" # Put on a reliable PATH prefix. # ...
At this point, given correct permissions on the directories called by PATH , the script has the ability to ensure that any utility it calls is the intended one. It is being very cautious because it assumes that implementation extensions may be present that would allow user functions to exist when it is invoked; this capability is not specified by this document, but it is not prohibited as an extension. For example, the ENV variable precedes the invocation of the script with a user startup script. Such a script could define functions to spoof the application.
Otherwise, the following exit values are returned:
Otherwise, the exit status of command will be that of the simple command specified by the arguments to command.