Browse Source

do not use possibly absent 'which' command

pull/154/head
bol-van 2 years ago
parent
commit
0459e0e450
  1. 14
      common/base.sh
  2. 6
      install_bin.sh

14
common/base.sh

@ -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

6
install_bin.sh

@ -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…
Cancel
Save