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
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -157,7 +157,12 @@ awk '/[0-9]+([.]?[0-9]+)+/ && !/not found$/{ · 156 unmodified lines | |||
| 157 | oprofiled --version 2>&1 | awk \ | 157 | oprofiled --version 2>&1 | awk \ |
| 158 | '(NR==1 && ($2 == "oprofile")) {print "oprofile ", $3}' | 158 | '(NR==1 && ($2 == "oprofile")) {print "oprofile ", $3}' |
| 159 | 159 | ||
| 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 | }' | ||
| 161 | 166 | ||
| 162 | udevinfo -V 2>&1 | grep version | awk '{print "udev ", $3}' | 167 | udevinfo -V 2>&1 | grep version | awk '{print "udev ", $3}' |
| 163 | 168 | ||