when I open zsh in vscode, it exports errors as follows:
/var/folders/5g/6zj9tk192w35xr6p5c79rmw80000gn/T/myname-code-zsh/.zshrc:37: can't create temp file for here document: permission denied
/var/folders/5g/6zj9tk192w35xr6p5c79rmw80000gn/T/myname-code-zsh/.zshrc:40: bad assignment
According to Gpt, I create an variant, then do the assignment.
VARNAME="$(echo ${ITEM%%=*})" VALUE="$(echo -e ${ITEM#*=})" eval "export $VARNAME="$VALUE""
It turns out to be futile, because vscode seems to overwrite this zshrc, then exports the same error again.
Corresponding code is as follows:
# Apply EnvironmentVariableCollections if needed
if [ -n "${VSCODE_ENV_REPLACE:-}" ]; then
IFS=':' read -rA ADDR <<< "$VSCODE_ENV_REPLACE" # permission denied error
for ITEM in "${ADDR[@]}"; do
VARNAME="$(echo ${ITEM%%=*})"
export $VARNAME="$(echo -e ${ITEM#*=})" # bad assignment
done
unset VSCODE_ENV_REPLACE
fi
if [ -n "${VSCODE_ENV_PREPEND:-}" ]; then
IFS=':' read -rA ADDR <<< "$VSCODE_ENV_PREPEND"
for ITEM in "${ADDR[@]}"; do
VARNAME="$(echo ${ITEM%%=*})"
export $VARNAME="$(echo -e ${ITEM#*=})${(P)VARNAME}"
done
unset VSCODE_ENV_PREPEND
fi
if [ -n "${VSCODE_ENV_APPEND:-}" ]; then
IFS=':' read -rA ADDR <<< "$VSCODE_ENV_APPEND"
for ITEM in "${ADDR[@]}"; do
VARNAME="$(echo ${ITEM%%=*})"
export $VARNAME="${(P)VARNAME}$(echo -e ${ITEM#*=})"
done
unset VSCODE_ENV_APPEND
fi
New contributor
Leslie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.