From 211cba3a5fdcb245e315df51fc096ed34e0c8dc9 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Sun, 14 Feb 2010 03:44:10 +0000 Subject: [PATCH] (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. --- inxi | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/inxi b/inxi index ca7678d..e7a4110 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.4.1 -#### Date: February 12 2010 +#### version: 1.4.2 +#### Date: February 13 2010 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -3198,7 +3198,7 @@ get_partition_data_advanced() eval $LOGFE } -# args: $1 - type +vsz/%cpu +# args: $1 - type -rss/%cpu Note: +rss not supported on older systems, like Etch get_ps_data() { 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 - array_length=${#A_PS_DATA[@]}; - while (( $i < $array_length/2 )) - do - reorder_temp=${A_PS_DATA[i]} - A_PS_DATA[i]=${A_PS_DATA[$array_length-$i-1]} - A_PS_DATA[$array_length-$i-1]=$reorder_temp - (( i++ )) - done + # this isn't necessary for -rss, and we can't make %cpu ordered the other way, so + # need to reverse it here. -rss is used because on older systems +rss is not supported + if [[ $1 == '%cpu' ]];then + array_length=${#A_PS_DATA[@]}; + while (( $i < $array_length/2 )) + do + reorder_temp=${A_PS_DATA[i]} + 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" @@ -4787,7 +4791,7 @@ print_ps_data() b_print_first='false' fi if [[ $B_SHOW_PS_MEM_DATA == 'true' ]];then - get_ps_data '+rss' + get_ps_data '-rss' print_ps_item 'mem' "$b_print_first" fi