You've already forked bash-ini-parser
mirror of
https://github.com/albfan/bash-ini-parser.git
synced 2025-08-09 05:22:44 +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"
|
||||
ini=( ${ini[*]/%+([[:space:]])\\]/\\]} ) # remove non meaningful whitespace after sections
|
||||
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 ="
|
||||
ini=( ${ini[*]/#\\[/\}$'\n'"$PREFIX"} ) # set section prefix
|
||||
debug
|
||||
|
Reference in New Issue
Block a user