-
Notifications
You must be signed in to change notification settings - Fork 0
man how
how
- show a command exit status
how [-p INDEX|-P|[COMMAND]...]
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.
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 @
how make
how -- "$@"
# identical to
eval -- "$@"; how
make "${TARGETS[@]}"; how
# identical to
how 'make "${TARGETS[@]}"'
javac *.java |& head -16; how -p 0