From ef315f6777620d44a16bc48b3e602ba1725cf095 Mon Sep 17 00:00:00 2001
From: Patrick Spek
Date: Sat, 6 Apr 2024 01:24:39 +0200
Subject: Fix config_subkeys_for when dealing with reference variables
---
lib/util/config.bash | 3 +++
1 file changed, 3 insertions(+)
(limited to 'lib')
diff --git a/lib/util/config.bash b/lib/util/config.bash
index 703dc4d..ff20bd0 100644
--- a/lib/util/config.bash
+++ b/lib/util/config.bash
@@ -138,6 +138,9 @@ config_subkeys_for() {
subkey="$(awk -F. '{ print $1 }' <<< "${result#"$key."}")"
+ # Remove trailing ampersand if it exists
+ [[ "${subkey: -1}" == "&" ]] && subkey="${subkey:0:-1}"
+
debug "bashtard/config_subkeys" "Found '$subkey' as subkey of '$key' through '$result'"
results+=("$subkey")
done < <(grep "^$key\." "$file" | awk -F= '{ print $1 }')
--
cgit v1.1