[PATCH 2/4] jshn.sh: Drop extraneous space when appending

Philip Prindeville philipp at redfish-solutions.com
Sun May 4 14:56:45 PDT 2025


From: Philip Prindeville <philipp at redfish-solutions.com>

Don't unnecessarily add a space before the first value when
appending to a list.

Signed-off-by: Felix Fietkau <nbd at nbd.name>
Signed-off-by: Philip Prindeville <philipp at redfish-solutions.com>
---
 sh/jshn.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sh/jshn.sh b/sh/jshn.sh
index 3f2f679187db96d77ccf27b15f5fc47cb8ee9796..3657642fd7673eeb417b0148af3e0b7c1e5c0825 100644
--- a/sh/jshn.sh
+++ b/sh/jshn.sh
@@ -23,7 +23,7 @@ __jshn_raw_append() {
 _jshn_append() {
 	# var=$1
 	local _a_value="$2"
-	eval "${JSON_PREFIX}$1=\"\${${JSON_PREFIX}$1} \$_a_value\""
+	eval "${JSON_PREFIX}$1=\"\${${JSON_PREFIX}$1}\${${JSON_PREFIX}$1:+ }\$_a_value\""
 }
 
 _get_var() {
-- 
2.43.0




More information about the openwrt-devel mailing list