Updated set fvoice script to work with ggrep on mac.

This commit is contained in:
Storm Dragon 2020-12-12 02:38:43 -05:00
parent 0403da6b0e
commit 3bdd559ae8

View File

@ -138,13 +138,21 @@ trap restore_voice SIGINT
# Create an array of available voices.
ifs="$IFS"
IFS=$'\n'
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
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[@]}"