conf functions improved

Prevent an issue with similar named variables.
This commit is contained in:
Cristhian Martínez Ochoa 2018-04-25 14:05:10 -06:00
parent d52f0fe866
commit d3830acfc8

View file

@ -169,14 +169,12 @@ conf_read() {
}
conf_write() {
if [[ ! -a /opt/webinoly/webinoly.conf ]]; then
sudo touch /opt/webinoly/webinoly.conf
fi
[[ ! -a /opt/webinoly/webinoly.conf ]] && sudo touch /opt/webinoly/webinoly.conf
#if requested VAR exists overwrite it, if not, create it.
sed -i "/${1}:/d" /opt/webinoly/webinoly.conf
sed -i "/^${1}:/d" /opt/webinoly/webinoly.conf
sh -c "echo -n '$1:$2\n' >> /opt/webinoly/webinoly.conf"
}
conf_delete() {
sed -i "/${1}:/d" /opt/webinoly/webinoly.conf
sed -i "/^${1}:/d" /opt/webinoly/webinoly.conf
}