mirror of
https://github.com/pi-hole/pi-hole
synced 2025-01-06 22:20:54 +00:00
Use tail instead of parameter expansion
Signed-off-by: Christian König <github@yubiuser.dev>
This commit is contained in:
parent
c777152c04
commit
3011d48b6f
@ -170,8 +170,9 @@ GetFTLData() {
|
|||||||
echo "${response}"
|
echo "${response}"
|
||||||
else
|
else
|
||||||
|
|
||||||
# status are the last 3 characters # status are the last 3 characters
|
# 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 is everything from response without the last 3 characters
|
||||||
data="${response%???}"
|
data="${response%???}"
|
||||||
|
|
||||||
@ -265,7 +266,8 @@ apiFunc() {
|
|||||||
response=$(GetFTLData "$1" raw)
|
response=$(GetFTLData "$1" raw)
|
||||||
|
|
||||||
# status are the last 3 characters
|
# 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 is everything from response without the last 3 characters
|
||||||
data="${response%???}"
|
data="${response%???}"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user