better solution to define used commands implemented

This commit is contained in:
2021-11-08 13:44:54 +01:00
parent 63274d1143
commit a67b3cdf5f
2 changed files with 18 additions and 23 deletions
+11
View File
@@ -35,6 +35,17 @@ std::die() {
exit $ec
}
std::def_cmds(){
local path="$1"
shift
for cmd in "$@"; do
eval declare -g ${cmd}=$(PATH="${path}" which $cmd 2>/dev/null)
if [[ -z "${!cmd}" ]]; then
std::die 255 "${cmd} not found"
fi
done
}
#
# get answer to yes/no question
#