scripts/env: use command -v instead of which
authorRosen Penev <rosenp@gmail.com>
Mon, 6 Jan 2020 02:32:35 +0000 (18:32 -0800)
committerPetr Štetiar <ynezz@true.cz>
Sat, 11 Jul 2020 11:33:28 +0000 (13:33 +0200)
Simpler and built in to the shell.

Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
scripts/env

index 7bfca58c5dd9dc815685e5003df2f1ca03cde772..563f39c1cfb3a66258e06edb2e6c1aeac6b96e09 100755 (executable)
@@ -57,7 +57,7 @@ env_init() {
        if [ -z "$CREATE" ]; then
                [ -d "$ENVDIR" ] || exit 0
        fi
-       [ -x "$(which git 2>/dev/null)" ] || error "Git is not installed"
+       command -v git || error "Git is not installed"
        mkdir -p "$ENVDIR" || error "Failed to create the environment directory"
        cd "$ENVDIR" || error "Failed to switch to the environment directory"
        [ -d .git ] || {