History

ver_linux: sh-utils, look for numerical input, not field number

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field. Tested on: Gentoo Linux Debian 6.0.10 Oracle Linux Server release 7.1

Alexander Kapshuk committed 11 years ago

Commit 29dfecf1 parent 7a343231 file · +6 −1Browse files

Unified · Split

scripts/ver_linux+6−1
@@ -157,7 +157,12 @@ awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{ · 156 unmodified lines
157157 oprofiled --version 2>&1 | awk \
158158 '(NR==1 && ($2 == "oprofile")) {print "oprofile ", $3}'
159159
160−expr --v 2>&1 | awk 'NR==1{print "Sh-utils ", $NF}'
160+expr --v 2>&1 |
161+awk '/^expr/{
162+ match($0, /[0-9]+([.]?[0-9]+)+/)
163+ printf("Sh-utils\t\t%s\n",
164+ substr($0,RSTART,RLENGTH))
165+}'
161166
162167 udevinfo -V 2>&1 | grep version | awk '{print "udev ", $3}'
163168