[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-build-common] branch master updated: switch existence over to 'ty
From: |
gnunet |
Subject: |
[taler-build-common] branch master updated: switch existence over to 'type', add shell check for type built-in support. |
Date: |
Mon, 16 Dec 2019 12:51:12 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository build-common.
The following commit(s) were added to refs/heads/master by this push:
new df3d04a switch existence over to 'type', add shell check for type
built-in support.
df3d04a is described below
commit df3d04affac9ec8cddea62a140cf6f3216094d6f
Author: ng0 <address@hidden>
AuthorDate: Mon Dec 16 11:50:31 2019 +0000
switch existence over to 'type', add shell check for type built-in support.
---
sh/lib.sh/existence.sh | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/sh/lib.sh/existence.sh b/sh/lib.sh/existence.sh
index a888dee..cddc3d6 100644
--- a/sh/lib.sh/existence.sh
+++ b/sh/lib.sh/existence.sh
@@ -18,10 +18,18 @@
#
# SPDX-License-Identifier: 0BSD
-# there is a function used in curl to replicate which(1), but
-# it uses too many other tools. this one uses command and in
-# gnunet so far has no reports about failures.
+errmsg=''
+
+# Check if shell supports builtin 'type'.
+if test -z "$errmsg"; then
+ if ! (eval 'type type') >/dev/null 2>&1
+ then
+ errmsg='Shell does not support type builtin'
+ exit 1
+ fi
+fi
+
existence()
{
- command -v "$1" >/dev/null 2>&1
+ type "$1" >/dev/null 2>&1
}
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-build-common] branch master updated: switch existence over to 'type', add shell check for type built-in support.,
gnunet <=