mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-30 05:50:53 +03:00
do not use possibly absent 'which' command
This commit is contained in:
parent
d5b104d781
commit
0459e0e450
@ -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
|
||||
|
@ -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()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user