How to use acute accent inside a string in a bash script?

Asked

Viewed 442 times

4

I use the script below to download Audios from google translator to use in a personal program that narrates codes and quantities of my stock. The problem is that the high-pitched "oh" accent of the code word is bringing a faulty audio, as if it were with an Echo error. If trying straight through the translator google site works, speaks code right.

#!/bin/bash
echo 'iniciando program'
while read line; do 
    echo $line
    wget -q -U Mozilla "http://translate.google.com/translate_tts?tl=pt&q=código: $line" -O $line.mp3
    break
done < codigos.txt
echo 'fim'

You can try that too:

#!/bin/bash
echo 'iniciando program'
wget -q -U Mozilla "http://translate.google.com/translate_tts?tl=pt&q=código: 3 5 6. 05 unidades" -O teste.mp3
echo 'fim'
  • Thalysson, it worked out?

  • 1

    It did work! : Thank you.

1 answer

3


You may need to specify the version of Mozilla to be used, for example Mozilla/5.0. Here there are other options.

The second example will look like this:

#!/bin/bash

echo 'iniciando program'
wget -U "Mozilla/5.0" -q "http://translate.google.com/translate_tts?tl=pt&q=código 3 5 6. 05 unidades" -O teste.mp3
echo 'fim' 
  • 1

    That’s right, I did the same and it worked... but the Qmechanic73 was faster... rsrsrs

Browser other questions tagged

You are not signed in. Login or sign up in order to post.