Files
dotfiles/utils/.local/bin/what
2026-02-21 18:10:09 +08:00

33 lines
570 B
Bash
Executable File

#!/usr/bin/env bash
#set -eo pipefail
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
cat <<EOF
Usage: $(basename "$0") [-h] <command>
Show detailed information about a command.
Options:
-h, --help Show this help message
Arguments:
command Command to investigate
EOF
exit 0
fi
set -x
type "$1" 2>/dev/null
type -t "$1" 2>/dev/null
type -a "$1" 2>/dev/null
type -P "$1" 2>/dev/null
which -a "$1" 2>/dev/null
which "$1" \
&& file -b "$(which "$1")" \
&& file -L "$(which "$1")"
type -a "$1" 2>/dev/null
command -v "$1"
whereis "$1"