Skip to content

man how

Jean-Raphaël Gaglione edited this page Feb 15, 2021 · 4 revisions

NAME

how - show a command exit status

SYNOPSIS

how [-p INDEX|-P|[COMMAND]...]

DESCRIPTION

Show the given command status. The status can be SUCCESS or FAILURE.
If no command is specified, it refers to the last command (with $?).

When the status is FAILURE and the exit status differs from 1, the exit status is specified.

This command returns the exactly same exit status, which make it a transparent command.

The pipe-status mode provides more detailed information, and can be enabled with -p (or -P).
When the pipe-status mode is enabled, how can only refers to the last command.
The content of ${PIPESTATUS[@]} will be lost, but the exit status is set to the first failure status among the selected pipe commands, or 0 if they are all successful.

OPTIONS

COMMAND : the command(s) to execute (optional)

-p, --pipe-status INDEX : show the status of the INDEX-th command in a line of piped commands. If INDEX is a negative number, start counting from the end. If INDEX is @, all the piped commands are selected.

-P, --pipe-status-all : alias for -p @

EXAMPLES

how make

how -- "$@"
# identical to
eval -- "$@"; how

make "${TARGETS[@]}"; how
# identical to
how 'make "${TARGETS[@]}"'

javac *.java |& head -16; how -p 0

Command manual

Clone this wiki locally