From 89580f29291aa4e04286ac74942f436500e038af Mon Sep 17 00:00:00 2001 From: William Hirigoyen Date: Fri, 26 Aug 2022 10:58:48 +0200 Subject: [PATCH] Fix variable reading in case VAR is specified multiple times in file. --- server/lib/includes | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/lib/includes b/server/lib/includes index 3653c40..3ed7bcd 100755 --- a/server/lib/includes +++ b/server/lib/includes @@ -445,7 +445,7 @@ read_variable() { pattern="^\s*${var_name}=.+" - grep --extended-regexp --only-matching "${pattern}" "${file}" | tail -1 | cut -d= -f2 + grep --extended-regexp --only-matching "${pattern}" "${file}" | tail -1 | cut -d= -f2 | head -1 } read_numerical_variable() { @@ -454,5 +454,5 @@ read_numerical_variable() { pattern="^\s*${var_name}=-?[0-9]+" - grep --extended-regexp --only-matching "${pattern}" "${file}" | tail -1 | cut -d= -f2 + grep --extended-regexp --only-matching "${pattern}" "${file}" | tail -1 | cut -d= -f2 | head -1 }