fix: update sed escape pattern to handle pipe delimiter in save_env_var function
This commit is contained in:
@@ -96,9 +96,9 @@ save_env_var() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape special characters in value for sed
|
# Escape special characters in value for sed (delimiter is |)
|
||||||
local escaped_value
|
local escaped_value
|
||||||
escaped_value=$(printf '%s' "$value" | sed 's/[&/\]/\\&/g')
|
escaped_value=$(printf '%s' "$value" | sed 's/[&/\|]/\\&/g')
|
||||||
|
|
||||||
if grep -q "^${key}=" "$env_file"; then
|
if grep -q "^${key}=" "$env_file"; then
|
||||||
# Replace existing line — match KEY= followed by anything (value + optional comment)
|
# Replace existing line — match KEY= followed by anything (value + optional comment)
|
||||||
|
|||||||
Reference in New Issue
Block a user