diff --git a/tools/whichcmd.sh b/tools/whichcmd.sh new file mode 100644 index 0000000..b630b1b --- /dev/null +++ b/tools/whichcmd.sh @@ -0,0 +1,15 @@ +#!/bin/env sh + +if [[ ${1} == "-h" ]] || [[ ${1} == "--help" ]] || [[ -z ${1} ]]; then + echo " +Find available commands in PATH by input syntax. +Usage: $(basename $0) +" + exit 0 +fi + +PATHS=($(echo "${PATH}" | sed 's/:/ /g') ) + +for p in ${PATHS[@]}; do + find "${p}" -iname "*${1}*" +done