summaryrefslogtreecommitdiff
path: root/src/parseconf.sh
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-06-05 14:09:43 +0100
committerdavidovski <david@davidovski.xyz>2022-06-05 14:09:43 +0100
commite6a5137690fb94f6379499f76a4a07811922a379 (patch)
tree65b3af0817c47df20caa4933a8d7e863e984c31c /src/parseconf.sh
parent830bb145b0e32737a49027b86267557598910446 (diff)
fixed comments not working when preceeded by whitespacev1.5.1
Diffstat (limited to 'src/parseconf.sh')
-rw-r--r--src/parseconf.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/parseconf.sh b/src/parseconf.sh
index abc6b36..d215a99 100644
--- a/src/parseconf.sh
+++ b/src/parseconf.sh
@@ -16,12 +16,14 @@ EOF
# parse a single config file line
#
parse_line() {
- [ $# = "0" ] && return
+ [ "$#" = 0 ] && return
local line="$@"
local key=$1
+
shift
local value="$@"
+ value=${value%#*}
case $key in
"include")
@@ -108,6 +110,6 @@ $print_keys &&
pattern="s/^$pattern:(.+)/\1/p;${count}"
# strip whitespace
-sed "s/^#.*$\|\s(\s\+)\|^\s\|\s^\|;*$//g" $CONF_FILE |
+sed "s/^\s*#.*$\|\s(\s\+)\|^\s\|\s^\|;*$//g" $CONF_FILE |
parse $@ |
sed -rn $pattern