From 1135d4e95dd3262431bb9b83ed30935df9b07ae9 Mon Sep 17 00:00:00 2001 From: Alberto Fanjul Date: Fri, 28 Aug 2020 20:31:31 +0200 Subject: [PATCH] bash: Extglob difference from bash 3 to 4 bash3 seems to be nongreedy --- bash-ini-parser | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bash-ini-parser b/bash-ini-parser index 12fcdea..3daf302 100755 --- a/bash-ini-parser +++ b/bash-ini-parser @@ -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