fish-shell/doc_src/command.txt

29 lines
1.3 KiB
Plaintext
Raw Normal View History

\section command command - run a program
\subsection command-synopsis Synopsis
2014-09-03 22:10:53 +08:00
\fish{synopsis}
command [OPTIONS] COMMANDNAME [ARGS...]
\endfish
\subsection command-description Description
`command` forces the shell to execute the program `COMMANDNAME` and ignore any functions or builtins with the same name.
The following options are available:
2017-06-24 06:42:38 +08:00
- `-a` or `--all` returns all the external commands that are found in `$PATH` in the order they are found.
- `-q` or `--quiet`, in conjunction with `-s`, silences the output and prints nothing, setting only the exit code.
2017-06-24 06:42:38 +08:00
- `-s` or `--search` returns the name of the external command that would be executed, or nothing if no file with the specified name could be found in the `$PATH`.
With the `-s` option, `command` treats every argument as a separate command to look up and sets the exit status to 0 if any of the specified commands were found, or 1 if no commands could be found. Additionally passing a `-q` or `--quiet` option prevents any paths from being printed, like the `type -q`, for testing only the exit status.
2014-09-03 22:10:53 +08:00
For basic compatibility with POSIX `command`, the `-v` flag is recognized as an alias for `-s`.
\subsection command-example Examples
2014-09-03 22:10:53 +08:00
`command ls` causes fish to execute the `ls` program, even if an `ls` function exists.
2014-09-03 22:10:53 +08:00
`command -s ls` returns the path to the `ls` program.