command(1) MPE/iX Shell and Utilities command(1)
______________________________________________________________________
NAME
command -- execute a simple command
SYNOPSIS
command [-p] command-name[argument...]
command [-V|-v] command-name
DESCRIPTION
command causes the shell to suppress its function lookup and exe-
cute 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(1)), some unique properties of special built-ins do not
apply:
* A syntax error in the utility does not cause the shell execut-
ing the utility to abort.
* Variable assignments specified with the special built-in util-
ity do not remain in effect after the shell has executed the
utility.
Options
command accepts the following 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 util-
ity, 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, func-
tion, 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 lc to list the contents of that directory.
function cd {
command cd $1
lc
}
Inside the function, we use command to get at the real cd. If we
didn't do this, the cd function would call itself in an infinite
1
command(1) MPE/iX Shell and Utilities command(1)
______________________________________________________________________
recursion.
ENVIRONMENT VARIABLES
command uses the following environment variable:
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 -v, possible exit status values are:
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 -v, possible exit status values are:
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 com-
mand-name.
Messages
Message: command-name: not found
Cause: You specified a command-name that command was unable to
find.
Action: Check that the command-name exists, was spelled prop-
erly, and that you have the appropriate permissions.
Message: Unknown option "-option"
Cause: You specified an option that is not valid for command.
Action: Check the DESCRIPTION section of this man page for a
list of valid command options.
PORTABILITY
POSIX.2. x/OPEN Portability Guide 4.0.
MPE/iX NOTES
For information on how the current MPE/iX implementation may
affect the operation of this utility, see Appendix A, MPE/iX
Implementation Considerations.
SEE ALSO
sh(1)
2