trying a bug fix for scrotwm/dwm issue of sending --version/-v to stderr instead of stdout

This commit is contained in:
inxi-svn 2011-05-27 20:49:14 +00:00
parent 7c99d71ecf
commit 8561e00ca9

15
inxi
View file

@ -2857,15 +2857,24 @@ get_desktop_environment()
# args: $1 - desktop command for --version; $2 - search string; $3 - gawk print number # args: $1 - desktop command for --version; $2 - search string; $3 - gawk print number
get_de_version() get_de_version()
{ {
local version='' get_version='--version' local version_data='' version='' get_version='--version'
case $1 in case $1 in
dwm|wmii) dwm|wmii)
get_version='-v' get_version='-v'
;; ;;
esac 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 { BEGIN {
IGNORECASE=1 IGNORECASE=1
} }
@ -2875,7 +2884,7 @@ get_de_version()
gsub(/(,|dwm-|wmii-|v|V)/, "",$'$3') gsub(/(,|dwm-|wmii-|v|V)/, "",$'$3')
print $'$3' print $'$3'
exit # quit after first match prints exit # quit after first match prints
}' ) }' <<< "$version_data" )
echo $version echo $version
} }