aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kapshuk <alexander.kapshuk@gmail.com>2015-10-12 14:39:42 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-18 00:55:26 -0400
commit1d60b873aecc6fce4893b76500c30374f8c9e394 (patch)
treede5176f5720dfe84d4b728e255b12bbc09c02a12
parent235024e519fa16242f916ec41b00547582f561a7 (diff)
ver_linux: make --version, use regex to find version number
Rely on regex to find the version number, rather than a field number. Reduce the number of 'awk' invocations from two to one. Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rwxr-xr-xscripts/ver_linux8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/ver_linux b/scripts/ver_linux
index af6467e4859a..31c0e4d09ffc 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -18,8 +18,12 @@ awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{
18 substr($0,RSTART,RLENGTH)) 18 substr($0,RSTART,RLENGTH))
19}' 19}'
20 20
21make --version 2>&1 | awk -F, '{print $1}' | awk \ 21make --version 2>&1 |
22 '/GNU Make/{print "Gnu make ",$NF}' 22awk '/GNU Make/{
23 match($0, /[0-9]+([.]?[0-9]+)+/)
24 printf("GNU Make\t\t%s\n",
25 substr($0,RSTART,RLENGTH))
26}'
23 27
24echo "binutils $(ld -v | egrep -o '[0-9]+\.[0-9\.]+')" 28echo "binutils $(ld -v | egrep -o '[0-9]+\.[0-9\.]+')"
25 29