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.
This commit is contained in:
Brooke Kuhlmann
2021-02-21 15:53:30 -07:00
parent 5e25c8d3f9
commit 2c518d797e

View File

@@ -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() {