Commit 3678f4f3 authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: replace which with command -v / type -fpP in print_command_path

parent f065a2f0
...@@ -154,23 +154,23 @@ verdocmd() ...@@ -154,23 +154,23 @@ verdocmd()
# copied from epm # copied from epm
# print a path to the command if exists in $PATH
if a= which which 2>/dev/null >/dev/null ; then # detect bash
# the best case if we have which command (other ways needs checking) is_bash()
# TODO: don't use which at all, it is binary, not builtin shell command
print_command_path()
{ {
a= which -- "$1" 2>/dev/null [ -n "$BASH_VERSION" ]
} }
elif a= type -a type 2>/dev/null >/dev/null ; then
# print a path to the command if exists in $PATH
if is_bash ; then
print_command_path() print_command_path()
{ {
a= type -fpP -- "$1" 2>/dev/null type -fpP -- "$1" 2>/dev/null
} }
else else
print_command_path() print_command_path()
{ {
a= type "$1" 2>/dev/null | sed -e 's|.* /|/|' command -v -- "$1" 2>/dev/null
} }
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