diff options
author | Alexander Kapshuk <alexander.kapshuk@gmail.com> | 2015-10-12 21:39:42 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-17 21:55:26 -0700 |
commit | 1d60b873aecc6fce4893b76500c30374f8c9e394 (patch) | |
tree | de5176f5720dfe84d4b728e255b12bbc09c02a12 /scripts | |
parent | 235024e519fa16242f916ec41b00547582f561a7 (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>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/ver_linux | 8 |
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$/{ substr($0,RSTART,RLENGTH)) }' -make --version 2>&1 | awk -F, '{print $1}' | awk \ - '/GNU Make/{print "Gnu make ",$NF}' +make --version 2>&1 | +awk '/GNU Make/{ + match($0, /[0-9]+([.]?[0-9]+)+/) + printf("GNU Make\t\t%s\n", + substr($0,RSTART,RLENGTH)) +}' echo "binutils $(ld -v | egrep -o '[0-9]+\.[0-9\.]+')" |