From 2c518d797e1e902c3828b2cd36d06caaeb49cdf4 Mon Sep 17 00:00:00 2001 From: Brooke Kuhlmann Date: Sun, 21 Feb 2021 15:53:30 -0700 Subject: [PATCH] Added CPU utility function Necessary for answering CPU of current machine when determining what kind of functionality should be used when executing scripts on Silicon or Intel based hardware. In this case, it'll answers "M1" when using an Apple Silicon chip. For Intel based machines, nothing will be answered since they use multiple "Processor" fields. --- lib/utilities.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/utilities.sh b/lib/utilities.sh index 92184fd..af714a6 100644 --- a/lib/utilities.sh +++ b/lib/utilities.sh @@ -28,6 +28,13 @@ get_basename() { } export -f get_basename +# Answers current CPU. +# Parameters: None. +get_cpu() { + printf "%s" "$(system_profiler SPHardwareDataType | awk '/Chip/ {print $3}')" +} +export -f get_cpu + # Answers the file extension. # Parameters: $1 (required) - The file name. get_extension() {