[[:space:]] -> " "

This commit is contained in:
stilez 2019-10-30 17:06:03 +00:00 committed by GitHub
parent 2422e0b481
commit a32b95544b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -215,7 +215,7 @@ _countdots() {
# $3 - regex to recognise useful return lines
_api_response_split() {
printf '%s' "$1" \
| sed -r 's/(^[[:space:]]+|[[:space:]]+$)//g' \
| sed -r 's/(^ +| +$)//g' \
| tr -d '\n\r' \
| sed -r "s/<\/?$2>/${NEWLINE}/g" \
| egrep "$3"
@ -241,15 +241,15 @@ _call_api() {
# Detect any <status> that isn't "ok". None of the used calls should fail if the API is working correctly.
# Also detect if there simply aren't any status lines (null result?) and report that, as well.
statuslines="$(echo "$pleskxml_prettyprint_result" | egrep '^[[:space:]]*<status>[^<]*</status>[[:space:]]*$')"
statuslines="$(echo "$pleskxml_prettyprint_result" | egrep '^ *<status>[^<]*</status> *$')"
if _value "$statuslines" | grep -qv '<status>ok</status>'; then
# We have some status lines that aren't "ok". Get the details
errtext="$(_value "$pleskxml_prettyprint_result" \
| egrep "(<status>|<errcode>|<errtext>)" \
| sed -r 's/^<(status|errcode|errtext)>/\1: /' \
| sed -r 's/(^[[:space:]]+|<\/(status|errcode|errtext)>$)//g'
| sed -r 's/^ *<(status|errcode|errtext)>/\1: /' \
| sed -r 's/<\/(status|errcode|errtext)>$//g'
)"
elif ! _value "$statuslines" | grep -q '<status>ok</status>'; then