diff --git a/server/CHANGELOG.md b/server/CHANGELOG.md index 8909a9f..98e7b12 100644 --- a/server/CHANGELOG.md +++ b/server/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed * shell syntax error when ${btrfs_bin} variable is empty +* read_variable + read_numerical_variable: keep the last found value only ### Security diff --git a/server/lib/includes b/server/lib/includes index 3892a2b..91321a3 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}" | cut -d= -f2 + grep --extended-regexp --only-matching "${pattern}" "${file}" | tail -1 | cut -d= -f2 } read_numerical_variable() { @@ -454,5 +454,5 @@ read_numerical_variable() { pattern="^\s*${var_name}=-?[0-9]+" - grep --extended-regexp --only-matching "${pattern}" "${file}" | cut -d= -f2 + grep --extended-regexp --only-matching "${pattern}" "${file}" | tail -1 | cut -d= -f2 }