(change version, small bug fix)

fixed small issue, discovered that etch bash/ps does not support the + operator for --sort, only -, eg: +rss fails and -rss works.
This commit is contained in:
inxi-svn 2010-02-14 03:44:10 +00:00
parent d43a83d93d
commit 211cba3a5f

28
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.4.1 #### version: 1.4.2
#### Date: February 12 2010 #### Date: February 13 2010
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
######################################################################## ########################################################################
@ -3198,7 +3198,7 @@ get_partition_data_advanced()
eval $LOGFE eval $LOGFE
} }
# args: $1 - type +vsz/%cpu # args: $1 - type -rss/%cpu Note: +rss not supported on older systems, like Etch
get_ps_data() get_ps_data()
{ {
eval $LOGFS eval $LOGFS
@ -3245,14 +3245,18 @@ get_ps_data()
} }
' ) ) ' ) )
# make the array ordered highest to lowest so output looks the way we expect it to # make the array ordered highest to lowest so output looks the way we expect it to
array_length=${#A_PS_DATA[@]}; # this isn't necessary for -rss, and we can't make %cpu ordered the other way, so
while (( $i < $array_length/2 )) # need to reverse it here. -rss is used because on older systems +rss is not supported
do if [[ $1 == '%cpu' ]];then
reorder_temp=${A_PS_DATA[i]} array_length=${#A_PS_DATA[@]};
A_PS_DATA[i]=${A_PS_DATA[$array_length-$i-1]} while (( $i < $array_length/2 ))
A_PS_DATA[$array_length-$i-1]=$reorder_temp do
(( i++ )) reorder_temp=${A_PS_DATA[i]}
done A_PS_DATA[i]=${A_PS_DATA[$array_length-$i-1]}
A_PS_DATA[$array_length-$i-1]=$reorder_temp
(( i++ ))
done
fi
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
@ -4787,7 +4791,7 @@ print_ps_data()
b_print_first='false' b_print_first='false'
fi fi
if [[ $B_SHOW_PS_MEM_DATA == 'true' ]];then if [[ $B_SHOW_PS_MEM_DATA == 'true' ]];then
get_ps_data '+rss' get_ps_data '-rss'
print_ps_item 'mem' "$b_print_first" print_ps_item 'mem' "$b_print_first"
fi fi