1
0
mirror of https://github.com/albfan/bash-ini-parser.git synced 2025-08-04 19:42:06 +03:00

remove only real comments

fixes #12
This commit is contained in:
albfan
2018-01-22 22:54:18 +01:00
parent b55c55f5fd
commit c6a35fc28b

View File

@@ -33,10 +33,10 @@ function cfg_parser {
debug "escaped ]"
IFS=$'\n' && ini=( ${ini} ) # convert to line-array
debug
ini=( ${ini[*]//;*/} ) # remove comments with ;
debug
ini=( ${ini[*]//\#*/} ) # remove comments with #
debug
ini=( ${ini[*]/#*([[:space:]]);*/} )
debug "remove ; comments"
ini=( ${ini[*]/#*([[:space:]])\#*/} )
debug "remove # comments"
ini=( ${ini[*]/#+([[:space:]])/} ) # remove init whitespace
debug
ini=( ${ini[*]/%+([[:space:]])/} ) # remove ending whitespace