diff options
author | Patrick Spek <p.spek@tyil.nl> | 2024-01-04 11:39:09 +0100 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2024-01-04 11:39:09 +0100 |
commit | 3675d3806f772bf864446dc091b1bbbe6ebf233a (patch) | |
tree | d70ff4b0684223a3c29a0bc101cdfb2993003c7c /lib/util/config.bash | |
parent | 6d214faf3505f9bb065e6c75b9056c271ae68f79 (diff) |
Fix values with = being used for templating
Diffstat (limited to 'lib/util/config.bash')
-rw-r--r-- | lib/util/config.bash | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/util/config.bash b/lib/util/config.bash index 4727706..76b6567 100644 --- a/lib/util/config.bash +++ b/lib/util/config.bash @@ -51,7 +51,12 @@ config_for() { [[ ! -f $file ]] && continue - value="$(awk -F= '$1 == "'"$key"'" { print $NF }' "$file")" + # Use awk to find the right line, then use cut to get the + # actual value. Cutting it out with awk _is_ possible, but + # comes with whitespace issues or having to deal with values + # containing the seperator (=), so using cut is much simpler + # and easier to understand. + value="$(awk -F= '$1 == "'"$key"'" { print $0 }' "$file" | cut -d'=' -f 2-)" if [[ -n $value ]] then |