Fix variable reading in case VAR is specified multiple times in file.
continuous-integration/drone/push Build is passing Details
gitea/evobackup/pipeline/head This commit looks good Details

This commit is contained in:
William Hirigoyen 2022-08-26 10:58:48 +02:00
parent c80881debf
commit 89580f2929
1 changed files with 2 additions and 2 deletions

View File

@ -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
}