mirror of
https://github.com/smxi/inxi.git
synced 2025-01-19 00:47:47 +00:00
Updated get_cpu_core_count to return an array of data like other functions, this helps make methods more consistent over
all get data functions
This commit is contained in:
parent
b11b8228c5
commit
582c6eecac
17
inxi
17
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 0.3.18
|
||||
#### version: 0.3.19
|
||||
#### Date: November 4 2008
|
||||
########################################################################
|
||||
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
||||
|
@ -56,6 +56,7 @@ IRC_CLIENT_VERSION=''
|
|||
### primary data array holders
|
||||
A_AUDIO_DATA=''
|
||||
A_CMDL=''
|
||||
A_CPU_CORE_DATA=''
|
||||
A_CPU_DATA=''
|
||||
A_GFX_CARD_DATA=''
|
||||
A_GLX_DATA=''
|
||||
|
@ -759,6 +760,7 @@ get_audio_data()
|
|||
fi
|
||||
}
|
||||
|
||||
## create A_CPU_CORE_DATA, currently with two values: integer core count; core string text
|
||||
## return value cpu core count string, this helps resolve the multi redundant lines of old style output
|
||||
get_cpu_core_count()
|
||||
{
|
||||
|
@ -768,7 +770,7 @@ get_cpu_core_count()
|
|||
if [ "$cpu_core_count" -eq 0 ];then
|
||||
cpu_core_count=$(grep -ic "^processor" /proc/cpuinfo| cut -d':' -f2)
|
||||
fi
|
||||
local cpu_alpha_count='' core_count=''
|
||||
local cpu_alpha_count=''
|
||||
|
||||
if [[ $cpu_core_count -lt 2 ]]; then
|
||||
cpu_core_count=1
|
||||
|
@ -788,9 +790,8 @@ get_cpu_core_count()
|
|||
10) cpu_alpha_count='Deca';;
|
||||
*) cpu_alpha_count='Multi';;
|
||||
esac
|
||||
## we'll be splitting the output to number of cores/core count string
|
||||
core_count="$cpu_core_count:$cpu_alpha_count Core"
|
||||
echo "$core_count"
|
||||
# create array, core count integer; core count string
|
||||
A_CPU_CORE_DATA=( "$cpu_core_count" "$cpu_alpha_count Core" )
|
||||
}
|
||||
|
||||
## working, will be replaced by new trash80 stuff
|
||||
|
@ -1655,8 +1656,10 @@ print_it_out()
|
|||
## note: remember that in bash, child functions inherit local variables
|
||||
local current_kernel=$( uname -a | gawk '{print $1,$3,$(NF-1)}' )
|
||||
local processes="$(( $( ps aux | wc -l ) - 1 ))"
|
||||
local cpu_core_count_string="$( get_cpu_core_count | cut -d ':' -f 2 )"
|
||||
local cpu_core_count="$( get_cpu_core_count | cut -d ':' -f 1 )"
|
||||
# set A_CPU_CORE_DATA
|
||||
get_cpu_core_count
|
||||
local cpu_core_count_string="${A_CPU_CORE_DATA[1]}"
|
||||
local cpu_core_count=${A_CPU_CORE_DATA[0]}
|
||||
local lspci_data='' ## only for verbose needed
|
||||
local up_time="$( get_uptime )"
|
||||
## assemble data for output
|
||||
|
|
Loading…
Reference in a new issue