From 3bdd559ae8784b4777802d52672e65657b73abdf Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 12 Dec 2020 02:38:43 -0500 Subject: [PATCH] Updated set fvoice script to work with ggrep on mac. --- speech/set-voice.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/speech/set-voice.sh b/speech/set-voice.sh index 7bddd1e..e736f34 100755 --- a/speech/set-voice.sh +++ b/speech/set-voice.sh @@ -138,13 +138,21 @@ trap restore_voice SIGINT # Create an array of available voices. ifs="$IFS" IFS=$'\n' -voiceListFullName=($(grep -P '\[Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^\\]+\].*' "${WINEPREFIX}/system.reg" | sed -E -e 's/\[([^]]+)\].*/\1/g')) +if [[ "$(uname)" == "Darwin" ]]; then + voiceListFullName=($(ggrep -P '\[Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^\\]+\].*' "${WINEPREFIX}/system.reg" | sed -E -e 's/\[([^]]+)\].*/\1/g')) +else + voiceListFullName=($(grep -P '\[Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^\\]+\].*' "${WINEPREFIX}/system.reg" | sed -E -e 's/\[([^]]+)\].*/\1/g')) +fi IFS="$ifs" voiceList=() for x in "${voiceListFullName[@]}" ; do voiceList+=("$(echo "$x" | rev | cut -d\\ -f1 | rev)") done -oldVoice="$(grep -P '"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"' "${WINEPREFIX}/user.reg" | sed -E -e 's/"DefaultTokenId"="([^"]+)"/\1/g')" +if [[ "$(uname)" == "Darwin" ]]; then + oldVoice="$(ggrep -P '"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"' "${WINEPREFIX}/user.reg" | sed -E -e 's/"DefaultTokenId"="([^"]+)"/\1/g')" +else + oldVoice="$(grep -P '"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"' "${WINEPREFIX}/user.reg" | sed -E -e 's/"DefaultTokenId"="([^"]+)"/\1/g')" +fi echo "oldVoice: ${oldVoice}" echo "voiceList: ${voiceList[@]}" echo "voiceListFullName: ${voiceListFullName[@]}"