diff --git a/src/common-utils/main.sh b/src/common-utils/main.sh index 7658c4850..670e0c2d2 100644 --- a/src/common-utils/main.sh +++ b/src/common-utils/main.sh @@ -551,7 +551,11 @@ if [ "${INSTALL_ZSH}" = "true" ]; then # Add devcontainer .zshrc template if [ "$INSTALL_OH_MY_ZSH_CONFIG" = "true" ]; then - echo -e "$(cat "${template_path}")\nDISABLE_AUTO_UPDATE=true\nDISABLE_UPDATE_PROMPT=true" > ${user_rc_file} + if [ -f "${template_path}" ] && grep -qF "$(head -n 1 "${template_path}")" "${user_rc_file}"; then + echo "No need to overwrite existing .zshrc file with the template file." + else + echo -e "$(cat "${template_path}")\nDISABLE_AUTO_UPDATE=true\nDISABLE_UPDATE_PROMPT=true" > ${user_rc_file} + fi sed -i -e 's/ZSH_THEME=.*/ZSH_THEME="devcontainers"/g' ${user_rc_file} fi