diff --git a/src/wg-quick/darwin.bash b/src/wg-quick/darwin.bash index 8e46818..1d27ad3 100755 --- a/src/wg-quick/darwin.bash +++ b/src/wg-quick/darwin.bash @@ -60,8 +60,8 @@ parse_options() { shopt -s nocasematch while read -r line || [[ -n $line ]]; do stripped="${line%%\#*}" - key="${stripped%%=*}"; key="${key##*([[:space:]])}"; key="${key%%*([[:space:]])}" - value="${stripped#*=}"; value="${value##*([[:space:]])}"; value="${value%%*([[:space:]])}" + key="${stripped%%=*}";key=$(echo $key | sed s/^[[:space:]]*//g | sed s/[[:space:]]*$//g) + value="${stripped#*=}"; value=$(echo $value | sed s/^[[:space:]]*//g | sed s/[[:space:]]*$//g) [[ $key == "["* ]] && interface_section=0 [[ $key == "[Interface]" ]] && interface_section=1 if [[ $interface_section -eq 1 ]]; then diff --git a/src/wg-quick/freebsd.bash b/src/wg-quick/freebsd.bash index b529ab2..8c7abc3 100755 --- a/src/wg-quick/freebsd.bash +++ b/src/wg-quick/freebsd.bash @@ -78,8 +78,8 @@ parse_options() { shopt -s nocasematch while read -r line || [[ -n $line ]]; do stripped="${line%%\#*}" - key="${stripped%%=*}"; key="${key##*([[:space:]])}"; key="${key%%*([[:space:]])}" - value="${stripped#*=}"; value="${value##*([[:space:]])}"; value="${value%%*([[:space:]])}" + key="${stripped%%=*}";key=$(echo $key | sed s/^[[:space:]]*//g | sed s/[[:space:]]*$//g) + value="${stripped#*=}"; value=$(echo $value | sed s/^[[:space:]]*//g | sed s/[[:space:]]*$//g) [[ $key == "["* ]] && interface_section=0 [[ $key == "[Interface]" ]] && interface_section=1 if [[ $interface_section -eq 1 ]]; then diff --git a/src/wg-quick/linux.bash b/src/wg-quick/linux.bash index e4d4c4f..98db5e0 100755 --- a/src/wg-quick/linux.bash +++ b/src/wg-quick/linux.bash @@ -49,8 +49,8 @@ parse_options() { shopt -s nocasematch while read -r line || [[ -n $line ]]; do stripped="${line%%\#*}" - key="${stripped%%=*}"; key="${key##*([[:space:]])}"; key="${key%%*([[:space:]])}" - value="${stripped#*=}"; value="${value##*([[:space:]])}"; value="${value%%*([[:space:]])}" + key="${stripped%%=*}";key=$(echo $key | sed s/^[[:space:]]*//g | sed s/[[:space:]]*$//g) + value="${stripped#*=}"; value=$(echo $value | sed s/^[[:space:]]*//g | sed s/[[:space:]]*$//g) [[ $key == "["* ]] && interface_section=0 [[ $key == "[Interface]" ]] && interface_section=1 if [[ $interface_section -eq 1 ]]; then diff --git a/src/wg-quick/openbsd.bash b/src/wg-quick/openbsd.bash index 2adfe46..94b5320 100755 --- a/src/wg-quick/openbsd.bash +++ b/src/wg-quick/openbsd.bash @@ -50,8 +50,8 @@ parse_options() { shopt -s nocasematch while read -r line || [[ -n $line ]]; do stripped="${line%%\#*}" - key="${stripped%%=*}"; key="${key##*([[:space:]])}"; key="${key%%*([[:space:]])}" - value="${stripped#*=}"; value="${value##*([[:space:]])}"; value="${value%%*([[:space:]])}" + key="${stripped%%=*}";key=$(echo $key | sed s/^[[:space:]]*//g | sed s/[[:space:]]*$//g) + value="${stripped#*=}"; value=$(echo $value | sed s/^[[:space:]]*//g | sed s/[[:space:]]*$//g) [[ $key == "["* ]] && interface_section=0 [[ $key == "[Interface]" ]] && interface_section=1 if [[ $interface_section -eq 1 ]]; then