dusting (cleaning)

This commit is contained in:
mfgbhatti 2022-01-24 20:11:12 +00:00
parent c700852936
commit 52d8a4c3f0
1 changed files with 12 additions and 5 deletions

View File

@ -4,19 +4,26 @@
# user name, password, etc. # user name, password, etc.
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# set up a config file # set up a config file
CONFIG_FILE=$SCRIPT_DIR/setup.conf CONFIG_FILE=$SCRIPT_DIR/setup.conf
if [ ! -f "$CONFIG_FILE" ]; then # check if file exists # check if file exists
touch -f "$CONFIG_FILE" # create file if not exists if [ ! -f "$CONFIG_FILE" ]; then
# create file if not exists
touch -f "$CONFIG_FILE"
fi fi
# set options in setup.conf # set options in setup.conf
set_option() { set_option() {
if grep -Eq "^${1}.*" "$CONFIG_FILE"; then # check if option exists # check if option exists
sed -i -e "/^${1}.*/d" "$CONFIG_FILE" # delete option if exists if grep -Eq "^${1}.*" "$CONFIG_FILE"; then
# delete option if exists
sed -i -e "/^${1}.*/d" "$CONFIG_FILE"
fi fi
echo "${1}=${2}" >> "$CONFIG_FILE" # add option # else add option
echo "${1}=${2}" >> "$CONFIG_FILE"
} }
logo () { logo () {
# This will be shown on every set as user is progressing # This will be shown on every set as user is progressing
echo -ne " echo -ne "