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

4

I use the script below to download audios from google translator for use in a personal program that tracks codes and quantities from my stock. The problem is that the acute "oh" accent of the word code is bringing a faulty audio, as if it were encode. If you try to go straight through google translator website it works, speak right code.

#!/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 this 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'
    
asked by anonymous 31.03.2015 / 13:50

1 answer

3

You may need to specify the Mozilla version to use, 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' 
    
31.03.2015 / 15:48