[OpenWrt-Devel] [PATCH] scripts/env: use command -v instead of which
Rosen Penev
rosenp at gmail.com
Tue Dec 31 21:03:31 EST 2019
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 84166ae5fe..69b63895b4 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 ] || {
--
2.24.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list