From 493f36bab368784e4e9c1b1aebefb223173acabd Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Tue, 26 Apr 2011 19:50:18 +0000 Subject: [PATCH] fixed logic error in config file check/creation --- inxi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/inxi b/inxi index e161877..aeaf73e 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.4.85 +#### version: 1.4.86 #### Date: April 26 2011 ######################################################################## #### SPECIAL THANKS @@ -905,16 +905,18 @@ select_default_color_scheme() ;; esac set_color_scheme $user_selection - if [[ ! -f $config_file || -z $( grep -s "$config_variable=" $config_file ) ]];then + # make file/directory first if missing + if [[ ! -f $config_file ]];then if [[ ! -d $HOME/.$SCRIPT_NAME ]];then mkdir $HOME/.$SCRIPT_NAME fi touch $config_file + fi + if [[ -z $( grep -s "$config_variable=" $config_file ) ]];then print_screen_output "Creating and updating config file for $COLOR_SELECTION color scheme now..." echo "$config_variable=$user_selection" >> $config_file else print_screen_output "Updating config file for $COLOR_SELECTION color scheme now..." - touch $config_file # just in case of logic error above sed -i "s/$config_variable=.*/$config_variable=$user_selection/" $config_file fi # file exists now so we can go on to cleanup