forked from evolix/evobackup
read_variable + read_numerical_variable: keep the last found value only
This commit is contained in:
parent
9745d78a16
commit
d2daef52d9
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue