You've already forked bash-ini-parser
mirror of
https://github.com/albfan/bash-ini-parser.git
synced 2025-08-12 03:42:42 +03:00
bash: Extglob difference from bash 3 to 4
bash3 seems to be nongreedy
This commit is contained in:
@@ -42,7 +42,14 @@ function cfg_parser {
|
|||||||
debug "removed ending whitespace"
|
debug "removed ending whitespace"
|
||||||
ini=( ${ini[*]/%+([[:space:]])\\]/\\]} ) # remove non meaningful whitespace after sections
|
ini=( ${ini[*]/%+([[:space:]])\\]/\\]} ) # remove non meaningful whitespace after sections
|
||||||
debug "removed whitespace after section name"
|
debug "removed whitespace after section name"
|
||||||
ini=( ${ini[*]/*([[:space:]])=*([[:space:]])/=} ) # remove whitespace around =
|
if [ $BASH_VERSINFO == 3 ]
|
||||||
|
then
|
||||||
|
ini=( ${ini[*]/+([[:space:]])=/=} ) # remove whitespace before =
|
||||||
|
ini=( ${ini[*]/=+([[:space:]])/=} ) # remove whitespace after =
|
||||||
|
ini=( ${ini[*]/+([[:space:]])=+([[:space:]])/=} ) # remove whitespace around =
|
||||||
|
else
|
||||||
|
ini=( ${ini[*]/*([[:space:]])=*([[:space:]])/=} ) # remove whitespace around =
|
||||||
|
fi
|
||||||
debug "removed space around ="
|
debug "removed space around ="
|
||||||
ini=( ${ini[*]/#\\[/\}$'\n'"$PREFIX"} ) # set section prefix
|
ini=( ${ini[*]/#\\[/\}$'\n'"$PREFIX"} ) # set section prefix
|
||||||
debug
|
debug
|
||||||
|
Reference in New Issue
Block a user