Skip to contentSkip to conversation

ver_linux: use lscpu command result instead of /proc/cpuinfo

PATCH New Masayoshi Mizuma 2 participants 3 messages Aug 15, 2018 – Sep 27, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ver_linux: use lscpu command result instead of /proc/cpuinfo

From: Masayoshi Mizuma <[email protected]>

lscpu command shows the cpu information clearly. So let's use the result if the command is installed to the system.

---
 ver_linux | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
ver_linux +7 -2
index dda337926..5f9260f5f 100755
@@ -96,5 +96,10 @@ echo 'free reports:'
 free
 
 echo
-echo '/proc/cpuinfo'
-cat /proc/cpuinfo
+echo 'cpuinfo:'
+which lscpu > /dev/null 2>&1
+if [ $? -eq 0 ]; then
+	lscpu
+else
+	cat /proc/cpuinfo
+fi
Signature · 1 line
2.18.0
#1 lore raw

PATCH 1/1 ver_linux: use lscpu command result instead of /proc/cpuinfo

Hi!

Quoted 10 lines
---
 ver_linux | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
ver_linux +0 -0
index dda337926..5f9260f5f 100755

ver_linux echo 'free reports:' · line 101

Quoted 8 lines
ver_linux +3 -2
@@ -96,5 +96,10 @@ echo 'free reports:'
 free
 
 echo
-echo '/proc/cpuinfo'
-cat /proc/cpuinfo
+echo 'cpuinfo:'
+which lscpu > /dev/null 2>&1
+if [ $? -eq 0 ]; then

You can just write:

if which lscpu > /dev/null 2>&1; then
...

Other than that it's fine.

Signature · 2 lines
Cyril Hrubis
[email protected]
#2 lore raw

PATCH 1/1 ver_linux: use lscpu command result instead of /proc/cpuinfo

Quoted 22 lines · Cyril Hrubis

Hi!

Quoted 10 lines
---
 ver_linux | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
ver_linux +0 -0
index dda337926..5f9260f5f 100755

ver_linux echo 'free reports:' · line 101

Quoted 8 lines
ver_linux +3 -2
@@ -96,5 +96,10 @@ echo 'free reports:'
 free
 
 echo
-echo '/proc/cpuinfo'
-cat /proc/cpuinfo
+echo 'cpuinfo:'
+which lscpu > /dev/null 2>&1
+if [ $? -eq 0 ]; then

You can just write:

Quoted 5 lines

if which lscpu > /dev/null 2>&1; then
...

Other than that it's fine.

Thanks! I'll send the v2 soon.

- Masa