1
0
mirror of https://github.com/pi-hole/pi-hole synced 2025-01-02 20:20:56 +00:00

Use tail instead of parameter expansion

Signed-off-by: Christian König <github@yubiuser.dev>
This commit is contained in:
Christian König 2024-12-22 23:30:14 +01:00
parent c777152c04
commit 3011d48b6f
No known key found for this signature in database

View File

@ -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%???}"