From 6ef6a381c5ddea327f807edafac10d1cf1718cfd Mon Sep 17 00:00:00 2001 From: Piotr Gnus Date: Wed, 13 Dec 2023 17:13:02 +0100 Subject: [PATCH] fix: Profile path no longer being cut off on space Adjusted calls for setting ini variables to not skip everything after first whitespace as well as adjusted method of reading ini file to not skip them. Refs: #840 --- install.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 185af73f..ab6c3772 100755 --- a/install.sh +++ b/install.sh @@ -185,7 +185,7 @@ write_file() { get_ini_section() { local filePath="$1" - local output=$(grep -E "^\[" "${filePath}" |sed -e "s/^\[//g" -e "s/\]$//g") + local output="$(grep -E "^\[" "${filePath}" |sed -e "s/^\[//g" -e "s/\]$//g")" echo "${output}" } get_ini_value() { @@ -195,11 +195,11 @@ get_ini_value() { local output="" if [ "${section}" == "" ]; then - output=$(grep -E "^${key}" "${filePath}" | cut -f 2 -d"=") + output="$(grep -E "^${key}" "${filePath}" | cut -f 2 -d"=")" echo "${output}" else local sectionStart="" - for line in $(cat "${filePath}"); do + while IFS= read line; do if [[ "${sectionStart}" == "true" && "${line}" == "["* ]]; then return 0 fi @@ -209,12 +209,12 @@ get_ini_value() { fi if [ "${sectionStart}" == "true" ]; then - output=$(echo "${line}" | grep -E "^${key}" | cut -f 2 -d"=" ) + output="$(echo "${line}" | grep -E "^${key}" | cut -f 2 -d"=" )" if [ "${output}" != "" ]; then echo "${output}" fi fi - done + done < "${filePath}" fi } @@ -543,7 +543,7 @@ write_lepton_info() { fi for key in "Type" "Branch" "Ver" "Path"; do eval "local value=\${${key}}" - output="${output}$(set_ini_value ${key} ${value})" + output="${output}$(set_ini_value "${key}" "${value}")" done # Latest element flushing