Skip to content

Commit

Permalink
Use encoded x3a to represent colon in bash
Browse files Browse the repository at this point in the history
Part of #181934
  • Loading branch information
Tyriar committed May 17, 2023
1 parent 44a490b commit 1d634d9
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ if [ -n "$VSCODE_ENV_REPLACE" ]; then
IFS=':' read -ra ADDR <<< "$VSCODE_ENV_REPLACE"
for ITEM in "${ADDR[@]}"; do
VARNAME="$(echo $ITEM | cut -d "=" -f 1)"
VALUE="$(echo $ITEM | cut -d "=" -f 2)"
# Use -e to encoded expand colons and other sequences
VALUE="$(echo -e "$ITEM" | cut -d "=" -f 2)"
export $VARNAME="$VALUE"
done
builtin unset VSCODE_ENV_REPLACE
Expand All @@ -59,7 +60,8 @@ if [ -n "$VSCODE_ENV_PREPEND" ]; then
IFS=':' read -ra ADDR <<< "$VSCODE_ENV_PREPEND"
for ITEM in "${ADDR[@]}"; do
VARNAME="$(echo $ITEM | cut -d "=" -f 1)"
VALUE="$(echo $ITEM | cut -d "=" -f 2)"
# Use -e to encoded expand colons and other sequences
VALUE="$(echo -e "$ITEM" | cut -d "=" -f 2)"
export $VARNAME="$VALUE${!VARNAME}"
done
builtin unset VSCODE_ENV_PREPEND
Expand All @@ -68,7 +70,8 @@ if [ -n "$VSCODE_ENV_APPEND" ]; then
IFS=':' read -ra ADDR <<< "$VSCODE_ENV_APPEND"
for ITEM in "${ADDR[@]}"; do
VARNAME="$(echo $ITEM | cut -d "=" -f 1)"
VALUE="$(echo $ITEM | cut -d "=" -f 2)"
# Use -e to encoded expand colons and other sequences
VALUE="$(echo -e "$ITEM" | cut -d "=" -f 2)"
export $VARNAME="${!VARNAME}$VALUE"
done
builtin unset VSCODE_ENV_APPEND
Expand Down

0 comments on commit 1d634d9

Please sign in to comment.