From d3830acfc8921f5adf3ec10c5d3b494d8243ef36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristhian=20Mart=C3=ADnez=20Ochoa?= Date: Wed, 25 Apr 2018 14:05:10 -0600 Subject: [PATCH] conf functions improved Prevent an issue with similar named variables. --- lib/general | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/general b/lib/general index 6dc74f1..d0184f3 100644 --- a/lib/general +++ b/lib/general @@ -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 } \ No newline at end of file