From 6f03cfb35185b3e0b5437c7e0f1c36ce2f17fce7 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Wed, 20 Jul 2011 04:11:44 +0000 Subject: [PATCH] fixed a glitch in x version, out of x tests can fail if strings contain (...) type endings, which newer debian's do. --- inxi | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/inxi b/inxi index 14ebca0..6fff74d 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.7.16 +#### version: 1.7.17 #### Date: July 19 2011 #### Patch Number: 00 ######################################################################## @@ -3927,28 +3927,32 @@ get_graphics_x_data() get_graphics_x_version() { eval $LOGFS - local x_version='' + local x_version='' x_data='' # note that some users can have /usr/bin/Xorg but not /usr/bin/X if [[ -n $( type -p X ) ]];then # note: MUST be this syntax: X -version 2>&1 # otherwise X -version overrides everything and this comes out null. - # two knowns id strings: X.Org X Server 1.7.5 AND Window System Version 1.7.5 + # two knowns id strings: X.Org X Server 1.7.5 AND X Window System Version 1.7.5 #X -version 2>&1 | gawk '/^X Window System Version/ { print $5 }' - x_version=$( X -version 2>&1 | gawk ' - BEGIN { - IGNORECASE=1 - } - /x.org x server|X Window System Version/ { - print $NF - }' ) + x_data="$( X -version 2>&1 )" elif [[ -n $( type -p Xorg ) ]];then - x_version=$( Xorg -version 2>&1 | gawk ' + x_data="$( Xorg -version 2>&1)" + fi + if [[ -n $x_data ]];then + x_version=$( + gawk ' BEGIN { IGNORECASE=1 } - /x.org x server|X Window System Version/ { - print $NF - }' ) + /^x.org x server/ { + print $4 + exit + } + /^X Window System Version/ { + print $5 + exit + }' <<< "$x_data" + ) fi echo $x_version log_function_data " x_version: $x_version"