about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJami Kettunen <jami.kettunen@protonmail.com>2022-02-21 16:17:42 +0200
committerLeah Neukirchen <leah@vuxu.org>2022-09-12 14:26:51 +0200
commit0a06dddd7c56bc97b8f55a15b911bda8221a51a6 (patch)
tree343e30ff9204e22b83d3ae9f58def3a8e67330b6
parent1aa10d734b3cfd6fcfa112a9404f7420c649050f (diff)
downloadxtools-0a06dddd7c56bc97b8f55a15b911bda8221a51a6.tar.gz
xtools-0a06dddd7c56bc97b8f55a15b911bda8221a51a6.tar.xz
xtools-0a06dddd7c56bc97b8f55a15b911bda8221a51a6.zip
xuname: avoid "cat abuse" and run awk directly on /proc/cpuinfo
-rwxr-xr-xxuname4
1 files changed, 2 insertions, 2 deletions
diff --git a/xuname b/xuname
index da56a50..f05013f 100755
--- a/xuname
+++ b/xuname
@@ -8,8 +8,8 @@ OUTDATED=$(xbps-install -Mun)
 HOLD=$(xbps-query -H)
 VM=$(dmesg 2>/dev/null | awk '/Hypervisor detected/{print $NF}')
 [ -z "$VM" ] && grep -q hypervisor /proc/cpuinfo && VM=VM
-CPU=$(cat /proc/cpuinfo |awk '/^vendor_id/{print $NF;exit}')
-[ -z "$CPU" ] && CPU=$(cat /proc/cpuinfo |awk '/^platform/{print $NF;exit}')
+CPU=$(awk '/^vendor_id/{print $NF;exit}' /proc/cpuinfo)
+[ -z "$CPU" ] && CPU=$(awk '/^platform/{print $NF;exit}' /proc/cpuinfo)
 REPO=$(xbps-query --regex -p repository -s '.' | cut -d/ -f2- | sort -u | awk '
 	/^\/repo-default.voidlinux.org\/current\/multilib/ {m=m"m"}
 	/^\/repo-default.voidlinux.org\/current\/debug/ {d=d"d"}