summaryrefslogtreecommitdiffstats
path: root/scripts/pahole-version.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/pahole-version.sh')
-rwxr-xr-xscripts/pahole-version.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/pahole-version.sh b/scripts/pahole-version.sh
new file mode 100755
index 000000000..f8a32ab93
--- /dev/null
+++ b/scripts/pahole-version.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+#
+# Usage: $ ./pahole-version.sh pahole
+#
+# Prints pahole's version in a 3-digit form, such as 119 for v1.19.
+
+if [ ! -x "$(command -v "$@")" ]; then
+ echo 0
+ exit 1
+fi
+
+"$@" --version | sed -E 's/v([0-9]+)\.([0-9]+)/\1\2/'