[glib: 1/2] Use "command -v" instead of "which"
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] Use "command -v" instead of "which"
- Date: Fri, 31 Aug 2018 11:12:50 +0000 (UTC)
commit 2c85e0a498ee91895b310ae3a9c83f32a0d0d90f
Author: Ryan Schmidt <git ryandesign com>
Date: Mon Aug 27 20:54:58 2018 -0500
Use "command -v" instead of "which"
The behavior of "which" is not standardized by POSIX. Some old
implementations print their error messages to stdout instead of stderr,
and don't return a nonzero exit code when they fail to find the given
program. "command -v" on the other hand is in POSIX (optional in 2004
and required as of 2008).
Remove otherwise-unused variables AUTORECONF and GTKDOCIZE.
autogen.sh | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/autogen.sh b/autogen.sh
index 9e4ba4c39..7c8c306d8 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -7,8 +7,7 @@ test -n "$srcdir" || srcdir=.
olddir=`pwd`
cd "$srcdir"
-GTKDOCIZE=$(which gtkdocize 2>/dev/null)
-if test -z $GTKDOCIZE; then
+if ! command -v gtkdocize >/dev/null 2>&1; then
echo "You don't have gtk-doc installed, and thus won't be able to generate the documentation."
rm -f gtk-doc.make
cat > gtk-doc.make <<EOF
@@ -19,8 +18,7 @@ else
gtkdocize || exit $?
fi
-AUTORECONF=`which autoreconf`
-if test -z $AUTORECONF; then
+if ! command -v autoreconf >/dev/null 2>&1; then
echo "*** No autoreconf found, please install it ***"
exit 1
fi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]