From 199377f147e15173d029b6c80c3c6990015251fc Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Wed, 25 May 2011 23:11:31 +0000 Subject: [PATCH] cleaned up, refactored irc tty version function --- inxi | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/inxi b/inxi index e18bb6d..7aad068 100755 --- a/inxi +++ b/inxi @@ -2416,7 +2416,14 @@ get_console_irc_tty() eval $LOGFS local tty_number='' if [[ -n ${IRC_CLIENT} ]];then - tty_number=$( ps aux | grep -is "${IRC_CLIENT}" | grep -v 'grep' | gawk '{print $7}' | sed 's/[^0-9]//g' ) + tty_number=$( ps aux | gawk ' + BEGIN { + IGNORECASE=1 + } + /'${IRC_CLIENT}'/ { + gsub(/[^0-9]/, "", $7) + print $7 + }' ) fi echo $tty_number eval $LOGFE @@ -2655,7 +2662,7 @@ get_cpu_ht_multicore_smp_data() # Detect desktop environment in use, logic from: compiz-check # http://forlong.blogage.de/entries/pages/Compiz-Check -detect_desktop_environment() +get_desktop_environment() { eval $LOGFS @@ -3129,6 +3136,7 @@ get_graphics_glx_data() # if ( $2 ~ / r[3-9][0-9][0-9] / ) { gsub(/'"$BAN_LIST_NORMAL"'/, "", $2) gsub(/ [ \t]+/, " ", $2) # get rid of the created white spaces + gsub(/^ +| +$/, "", $0) a[$2] # this counter failed in one case, a bug, and is not needed now # f++ @@ -6352,7 +6360,7 @@ print_system_data() # I think these will work, maybe, if logged in as root and in X if [[ $B_RUNNING_IN_X == 'true' ]];then - desktop_environment=$( detect_desktop_environment ) + desktop_environment=$( get_desktop_environment ) if [[ -z $desktop_environment ]];then desktop_environment='N/A' fi