Messages in this thread Patch in this message |  | | From | Alexander Kapshuk <> | | Date | Sat, 3 Oct 2015 16:29:10 +0300 | | Subject | [PATCH 9/24] ver_linux: jfsutils.patch |
| |
Not to be critical of anyone, I believe that using 'grep' along with 'sed', and 'awk' in this kind of context as a one-off quick solution to be run on the command line may very well be justified. However, in a script, 'awk' or 'sed' are more than capable of doing most of the things we may be looking to achieve by using a combination of 'grep', 'sed', and 'awk'.
The proposed implementation relies on 'sed' to perform all the text processing required.
Tested on: Arch Linux
Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com> --- --- linux/scripts/ver_linux.orig 2015-10-03 13:41:57.118790241 +0300 +++ linux/scripts/ver_linux 2015-10-03 13:52:43.291120818 +0300 @@ -30,8 +30,15 @@ tune2fs 2>&1 | grep "^tune2fs" | sed 's/,//' | awk \ 'NR==1 {print "e2fsprogs ", $2}'
-fsck.jfs -V 2>&1 | grep version | sed 's/,//' | awk \ -'NR==1 {print "jfsutils ", $3}' +test -x "$fsckjfs" && +$fsckjfs -V 2>&1 | +sed ' + /version/!d + s/.*version[ \t]// + s/[ \t].*// + s/[^0-9]$// + s/^/jfsutils\t\t/ +'
reiserfsck -V 2>&1 | grep ^reiserfsck | awk \ 'NR==1{print "reiserfsprogs ", $2}'
|  |