From d2913e6cee1de35fda33317c9e34edcaac4b97f0 Mon Sep 17 00:00:00 2001 From: Paulo Fagundes Date: Sat, 9 Nov 2019 10:23:21 -0700 Subject: [PATCH] Replace `which` with `command -v` Some distributions such as Arch Linux no longer install `which` by default through the base package (see https://www.archlinux.org/news/base-group-replaced-by-mandatory-base-package-manual-intervention-required/). The maintainers have explained why `command -v` is superior: https://www.reddit.com/r/archlinux/comments/de1er6/arch_linux_news_base_group_replaced_by_mandatory/f2v8uhu/. --- bin/dotbot | 6 +++--- test/tests/find-python-executable.bash | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/dotbot b/bin/dotbot index a2ffe9a..6232a50 100755 --- a/bin/dotbot +++ b/bin/dotbot @@ -7,9 +7,9 @@ # is useful because we don't know the name of the python binary. ''':' # begin python string; this line is interpreted by the shell as `:` -which python >/dev/null 2>&1 && exec python "$0" "$@" -which python3 >/dev/null 2>&1 && exec python3 "$0" "$@" -which python2 >/dev/null 2>&1 && exec python2 "$0" "$@" +command -v python >/dev/null 2>&1 && exec python "$0" "$@" +command -v python3 >/dev/null 2>&1 && exec python3 "$0" "$@" +command -v python2 >/dev/null 2>&1 && exec python2 "$0" "$@" >&2 echo "error: cannot find python" exit 1 ''' diff --git a/test/tests/find-python-executable.bash b/test/tests/find-python-executable.bash index d4fa7eb..9a91a74 100644 --- a/test/tests/find-python-executable.bash +++ b/test/tests/find-python-executable.bash @@ -31,7 +31,7 @@ touch ~/tmp_bin/python && chmod +x ~/tmp_bin/python && cat >> ~/tmp_bin/python <