* [PATCH] ver_linux: ldd.patch
@ 2015-10-01 18:34 Alexander Kapshuk
0 siblings, 0 replies; only message in thread
From: Alexander Kapshuk @ 2015-10-01 18:34 UTC (permalink / raw)
To: linux-kernel; +Cc: Greg KH
Not to be critical of anyone, I believe that using 'head' along with
'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' alone are more than capable of doing
most of the things we may be looking to achieve by using a combination of
'head', and 'awk'.
The proposed implementation relies on 'sed' to perform all the text
processing required.
Tested on:
Gentoo Linux
Debian 6.0.10
Oracle Linux Server release 7.1
Arch Linux
openSuSE 13.2
Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
--- linux/scripts/ver_linux.orig 2015-08-30 21:34:09.000000000 +0300
+++ linux/scripts/ver_linux 2015-09-30 22:53:42.750469252 +0300
@@ -62,8 +62,17 @@
echo -n "Linux C Library "
sed -n -e '/^.*\/libc-\([^/]*\)\.so$/{s//\1/;p;q}' < /proc/self/maps
-ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \
-'NR==1{print "Dynamic linker (ldd) ", $NF}'
+lddsed='
+ /^ldd/!d
+ s/.*[ \t]\([0-9\.]*$\)/\1/
+ s/^/Dynamic linker (ldd)\t/
+'
+if ldd -v >/dev/null 2>&1
+then
+ ldd -v 2>&1 | sed "$lddsed"
+else
+ ldd --version 2>&1 | sed "$lddsed"
+fi
ls -l /usr/lib/libg++.so /usr/lib/libstdc++.so 2>/dev/null | awk -F. \
'{print "Linux C++ Library " $4"."$5"."$6}'
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-10-01 18:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-01 18:34 [PATCH] ver_linux: ldd.patch Alexander Kapshuk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).