Skip to content

Commit

Permalink
ver_linux: reiserfsprogs, look for numerical input, not field number
Browse files Browse the repository at this point in the history
Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field.

Proposed implementation also eliminates the necessity to invoke 'grep' + 'awk'.

Signed-off-by: Alexander Kapshuk <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
alexkapshuk authored and gregkh committed Oct 18, 2015
1 parent 0fc8de5 commit 63e781a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/ver_linux
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@ awk '/version/{
substr($0,RSTART,RLENGTH))
}'

reiserfsck -V 2>&1 | grep ^reiserfsck | awk \
'NR==1{print "reiserfsprogs ", $2}'
reiserfsck -V 2>&1 |
awk '/^reiserfsck/{
match($0, /[0-9]+([.]?[0-9]+)+/)
printf("Reiserfsprogs\t\t%s\n",
substr($0,RSTART,RLENGTH))
}'

fsck.reiser4 -V 2>&1 | grep ^fsck.reiser4 | awk \
'NR==1{print "reiser4progs ", $2}'
Expand Down

0 comments on commit 63e781a

Please sign in to comment.