From 9df881c11fbf62d6042f5a274a27e9f881926415 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Fri, 27 May 2011 20:49:47 +0000 Subject: [PATCH] added in a null case check --- inxi | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/inxi b/inxi index 78c484c..7240133 100755 --- a/inxi +++ b/inxi @@ -2874,17 +2874,19 @@ get_de_version() ;; esac - version=$( gawk ' - BEGIN { - IGNORECASE=1 - } - /'$2'/ { - # sample: dwm-5.8.2, ©.. etc, why no space? who knows. Also get rid of v in number string - # xfce, and other, output has , in it, so dump all commas - gsub(/(,|dwm-|wmii-|v|V)/, "",$'$3') - print $'$3' - exit # quit after first match prints - }' <<< "$version_data" ) + if [[ -n $version_data ]];then + version=$( gawk ' + BEGIN { + IGNORECASE=1 + } + /'$2'/ { + # sample: dwm-5.8.2, ©.. etc, why no space? who knows. Also get rid of v in number string + # xfce, and other, output has , in it, so dump all commas + gsub(/(,|dwm-|wmii-|v|V)/, "",$'$3') + print $'$3' + exit # quit after first match prints + }' <<< "$version_data" ) + fi echo $version }