[openwrt/openwrt] scripts/env: use command -v instead of which

LEDE Commits lede-commits at lists.infradead.org
Sat Jul 11 09:54:47 EDT 2020


ynezz pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/56f813674a912490df327304033bf667b285930a

commit 56f813674a912490df327304033bf667b285930a
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Sun Jan 5 18:32:35 2020 -0800

    scripts/env: use command -v instead of which
    
    Simpler and built in to the shell.
    
    Found with shellcheck.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 scripts/env | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/env b/scripts/env
index 7bfca58c5d..563f39c1cf 100755
--- a/scripts/env
+++ b/scripts/env
@@ -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 ] || { 



More information about the lede-commits mailing list