This commit is contained in:
@@ -287,7 +287,8 @@ BASH
|
||||
read_env_value() {
|
||||
local file="$1"
|
||||
local key="$2"
|
||||
local line value
|
||||
local line value quote_char
|
||||
quote_char='"'
|
||||
|
||||
if [[ ! -f "${file}" ]]; then
|
||||
return
|
||||
@@ -296,10 +297,9 @@ BASH
|
||||
while IFS= read -r line || [[ -n "${line}" ]]; do
|
||||
if [[ "${line}" == "${key}="* ]]; then
|
||||
value="${line#*=}"
|
||||
value="$(printf "%s" "${value}" | tr -d "\\r")"
|
||||
if [[ "${value}" == \"* && "${value}" == *\" ]]; then
|
||||
value="${value#\"}"
|
||||
value="${value%\"}"
|
||||
value="$(printf "%s" "${value}" | tr -d "\r")"
|
||||
if [[ ${#value} -ge 2 && "${value:0:1}" == "${quote_char}" && "${value: -1}" == "${quote_char}" ]]; then
|
||||
value="${value:1:${#value}-2}"
|
||||
fi
|
||||
printf "%s" "${value}"
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user