From 3011d48b6f22996f36b2e72cad633484e9e3d0b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Sun, 22 Dec 2024 23:30:14 +0100 Subject: [PATCH] Use tail instead of parameter expansion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- advanced/Scripts/api.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/api.sh b/advanced/Scripts/api.sh index 785b8309..c9c2dd49 100755 --- a/advanced/Scripts/api.sh +++ b/advanced/Scripts/api.sh @@ -170,8 +170,9 @@ GetFTLData() { echo "${response}" else - # status are the last 3 characters # status are the last 3 characters - status="${response#"${response%???}"}" + # status are the last 3 characters + # not using ${response#"${response%???}"}" here because it's extremely slow on big responses + status=$(printf "%s" "${response}" | tail -c 3) # data is everything from response without the last 3 characters data="${response%???}" @@ -265,7 +266,8 @@ apiFunc() { response=$(GetFTLData "$1" raw) # status are the last 3 characters - status="${response#"${response%???}"}" + # not using ${response#"${response%???}"}" here because it's extremely slow on big responses + status=$(printf "%s" "${response}" | tail -c 3) # data is everything from response without the last 3 characters data="${response%???}"