From 2e3db5e3dcc293fd1474223fff591a33e3b4f762 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Thu, 16 Mar 2023 17:20:48 +0100 Subject: [PATCH] refactor: avoid subshell --- lib/util.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/util.sh b/lib/util.sh index a66eb81..daabba9 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -61,13 +61,13 @@ function get_cpu_vendor() { if [[ -z "${CPU_VENDOR}" ]] || [[ "${CPU_VENDOR}" == 'autodetect' ]]; then # If run virtual environment (e.g. VirtualBox) then no CPU microcode is required - if cat /proc/cpuinfo | grep '^flags.*hypervisor' >/dev/null; then + if grep '^flags.*hypervisor' /proc/cpuinfo >/dev/null; then echo 'Detected virtual environment.' CPU_VENDOR='none' else local vendor_id - vendor_id=$(cat /proc/cpuinfo | grep vendor_id | head -1 | sed 's|vendor_id\s*:\s*||') + vendor_id=$(grep vendor_id /proc/cpuinfo | head -1 | sed 's|vendor_id\s*:\s*||') if [ "${vendor_id}" = 'AuthenticAMD' ]; then CPU_VENDOR='amd'