do not use possibly absent 'which' command

This commit is contained in:
bol-van committed 2023-08-08 10:47:01 +03:00
1 parent d5b104d781
commit 0459e0e450
2 files changed
+16 -4

No files matched your search

+14
View File
@@ -1,3 +1,17 @@
which()
{
# on some systems 'which' command is considered deprecated and not installed by default
# 'command -v' replacement does not work exactly the same way. it outputs shell aliases if present
# $1 - executable name
local IFS=:
for p in $PATH; do
[ -x "$p/$1" ] && {
echo "$p/$1"
return 0
}
done
return 1
}
exists()
{
which "$1" >/dev/null 2>/dev/null
+2 -4
View File
@@ -5,10 +5,8 @@ EXEDIR="$(cd "$EXEDIR"; pwd)"
BINS=binaries
BINDIR="$EXEDIR/$BINS"
exists()
{
which "$1" >/dev/null 2>/dev/null
}
ZAPRET_BASE="$EXEDIR"
. "$ZAPRET_BASE/common/base.sh"
check_dir()
{