diff --git a/tojam b/tojam index ad9a631..aea0682 100755 --- a/tojam +++ b/tojam @@ -252,12 +252,22 @@ configure_ninjam() { [[ ${menuCode} -ne 0 ]] && continue fi fi - sed -i -e "s/^tts=.*/tts=\"${tts}\"/" -e "s/^ttsRate=.*/ttsRate=\"${ttsRate}\"/" "${config}/config" && - if [[ "${tts}" == "true" ]]; then - dialog --msgbox "TTS enabled at rate ${ttsRate}." -1 -1 - else - dialog --msgbox "TTS disabled." -1 -1 - fi + # Update or add TTS settings + if grep -q "^tts=" "${config}/config"; then + sed -i "s/^tts=.*/tts=\"${tts}\"/" "${config}/config" + else + echo "tts=\"${tts}\"" >> "${config}/config" + fi + if grep -q "^ttsRate=" "${config}/config"; then + sed -i "s/^ttsRate=.*/ttsRate=\"${ttsRate}\"/" "${config}/config" + else + echo "ttsRate=\"${ttsRate}\"" >> "${config}/config" + fi + if [[ "${tts}" == "true" ]]; then + dialog --msgbox "TTS enabled at rate ${ttsRate}." -1 -1 + else + dialog --msgbox "TTS disabled." -1 -1 + fi ;; "username") userName="$(dialog --backtitle "Tojam" \