mirror of
https://github.com/smxi/inxi.git
synced 2025-01-18 16:37:49 +00:00
Fixed cpu flag line print as well, uses arrays now, so no need to use numbered line outputs etc.
This commit is contained in:
parent
688e10e858
commit
3bb0d7d087
38
inxi
38
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 0.8.4
|
||||
#### version: 0.8.5
|
||||
#### Date: December 4 2008
|
||||
########################################################################
|
||||
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
|
||||
|
@ -2337,32 +2337,30 @@ print_cpu_data()
|
|||
# args: $1 - cpu flag string
|
||||
print_cpu_flags_full()
|
||||
{
|
||||
local cpu_flags_full="$1" cpu_flags_1='' cpu_flags_2='' cpu_flags_3='' flag_data=''
|
||||
local i=0 flag=''
|
||||
local cpu_flags_full="$1" a_cpu_flags='' line_starter=''
|
||||
local i=0 counter=0 max_length=18 max_length_add=18 flag='' flag_data=''
|
||||
|
||||
# build the flag line array
|
||||
for flag in $cpu_flags_full
|
||||
do
|
||||
if [[ $i -ge 36 ]];then
|
||||
cpu_flags_3="$cpu_flags_3$flag "
|
||||
elif [[ $i -ge 18 ]];then
|
||||
cpu_flags_2="$cpu_flags_2$flag "
|
||||
elif [[ $i -ge 0 ]];then
|
||||
cpu_flags_1="$cpu_flags_1$flag "
|
||||
a_cpu_flags[$counter]="${a_cpu_flags[$counter]}$flag "
|
||||
if [[ $i -ge $max_length ]];then
|
||||
(( counter++ ))
|
||||
max_length=$(( $max_length + $max_length_add ))
|
||||
fi
|
||||
((i++))
|
||||
done
|
||||
if [[ -n $cpu_flags_1 ]];then
|
||||
flag_data=$( create_print_line " " "${C1}CPU Flags${C2} $cpu_flags_1" )
|
||||
# then print it out
|
||||
for (( i=0; i < ${#a_cpu_flags[@]};i++ ))
|
||||
do
|
||||
if [[ $i -eq 0 ]];then
|
||||
line_starter="${C1}CPU Flags${C2} "
|
||||
else
|
||||
line_starter=''
|
||||
fi
|
||||
flag_data=$( create_print_line " " "$line_starter${a_cpu_flags[$i]}" )
|
||||
print_screen_output "$flag_data"
|
||||
fi
|
||||
if [[ -n $cpu_flags_2 ]];then
|
||||
flag_data=$( create_print_line " " "$cpu_flags_2" )
|
||||
print_screen_output "$flag_data"
|
||||
fi
|
||||
if [[ -n $cpu_flags_3 ]];then
|
||||
flag_data=$( create_print_line " " "$cpu_flags_3" )
|
||||
print_screen_output "$flag_data"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
print_gfx_data()
|
||||
|
|
Loading…
Reference in a new issue