From 8561e00ca95adbe62184ea7cf5eda22b18f58174 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Fri, 27 May 2011 20:49:14 +0000 Subject: [PATCH] trying a bug fix for scrotwm/dwm issue of sending --version/-v to stderr instead of stdout --- inxi | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/inxi b/inxi index 4926fe0..78c484c 100755 --- a/inxi +++ b/inxi @@ -2857,15 +2857,24 @@ get_desktop_environment() # args: $1 - desktop command for --version; $2 - search string; $3 - gawk print number get_de_version() { - local version='' get_version='--version' + local version_data='' version='' get_version='--version' case $1 in dwm|wmii) get_version='-v' ;; esac + # note, some wm send version info to stderr instead of stdout + case $1 in + dwm|scrotwm) + version_data="$( $1 $get_version )" + ;; + *) + version_data="$( $1 $get_version 2>/dev/null )" + ;; + esac - version=$( $1 $get_version 2>/dev/null | gawk ' + version=$( gawk ' BEGIN { IGNORECASE=1 } @@ -2875,7 +2884,7 @@ get_de_version() gsub(/(,|dwm-|wmii-|v|V)/, "",$'$3') print $'$3' exit # quit after first match prints - }' ) + }' <<< "$version_data" ) echo $version }