mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
fixed logic error in config file check/creation
This commit is contained in:
parent
9e5426b180
commit
493f36bab3
8
inxi
8
inxi
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 1.4.85
|
#### version: 1.4.86
|
||||||
#### Date: April 26 2011
|
#### Date: April 26 2011
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
|
@ -905,16 +905,18 @@ select_default_color_scheme()
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
set_color_scheme $user_selection
|
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
|
if [[ ! -d $HOME/.$SCRIPT_NAME ]];then
|
||||||
mkdir $HOME/.$SCRIPT_NAME
|
mkdir $HOME/.$SCRIPT_NAME
|
||||||
fi
|
fi
|
||||||
touch $config_file
|
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..."
|
print_screen_output "Creating and updating config file for $COLOR_SELECTION color scheme now..."
|
||||||
echo "$config_variable=$user_selection" >> $config_file
|
echo "$config_variable=$user_selection" >> $config_file
|
||||||
else
|
else
|
||||||
print_screen_output "Updating config file for $COLOR_SELECTION color scheme now..."
|
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
|
sed -i "s/$config_variable=.*/$config_variable=$user_selection/" $config_file
|
||||||
fi
|
fi
|
||||||
# file exists now so we can go on to cleanup
|
# file exists now so we can go on to cleanup
|
||||||
|
|
Loading…
Reference in a new issue