Commit 3b516178 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm-sh-functions: don't run some command directly

parent 580c8cfd
...@@ -58,7 +58,7 @@ check_tty() ...@@ -58,7 +58,7 @@ check_tty()
is_command tput || return is_command tput || return
# FreeBSD does not support tput -S # FreeBSD does not support tput -S
echo | tput -S >/dev/null 2>/dev/null || return echo | a= tput -S >/dev/null 2>/dev/null || return
[ -z "$USETTY" ] || return [ -z "$USETTY" ] || return
export USETTY=1 export USETTY=1
} }
...@@ -756,22 +756,22 @@ is_url() ...@@ -756,22 +756,22 @@ is_url()
} }
# print a path to the command if exists in $PATH # print a path to the command if exists in $PATH
if which which 2>/dev/null >/dev/null ; then if a= which which 2>/dev/null >/dev/null ; then
# the best case if we have which command (other ways needs checking) # the best case if we have which command (other ways needs checking)
# TODO: don't use which at all, it is binary, not builtin shell command # TODO: don't use which at all, it is binary, not builtin shell command
print_command_path() print_command_path()
{ {
which -- "$1" 2>/dev/null a= which -- "$1" 2>/dev/null
} }
elif type -a type 2>/dev/null >/dev/null ; then elif a= type -a type 2>/dev/null >/dev/null ; then
print_command_path() print_command_path()
{ {
type -fpP -- "$1" 2>/dev/null a= type -fpP -- "$1" 2>/dev/null
} }
else else
print_command_path() print_command_path()
{ {
type "$1" 2>/dev/null | sed -e 's|.* /|/|' a= type "$1" 2>/dev/null | sed -e 's|.* /|/|'
} }
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment