Category Archives: Bash Scripting

Bash … a new world / soundfile downloader

Yesterday I started to learn some bash basic programming because I needed to achieve a task and I knew that bash is the closest language to all my linux tools.

The task I needed to achieve was to download some sound files in different languages from, I needed those in order to polish a bit the languages I already know and to get some insight of their related sisters ;)
So basically, I wanted to make some sort of playlist that would be able to play the same ords/sentences in different languages one after another. Since offers 100 lessons each one containing 20 sound files, I have to get 2000 sound files per language for maximum 10 languages. Since I wanted no problems by messing around with tousands of files I decided to rename the files to be in the right place in my playlist by default.
So I started by diving in to bash for a couple of hours, and in the end I was able to build a pretty god (can always be better) bash script to do my job.
My first bash script :
# script to download audio files from based on their locale
while [ $count -le $limit ]
if [ $count -lt 10 ]; then
wget -nv -O 000${count}${locale}.mp3 ${baseUrl}${locale}/SOUND/000${count}.mp3
elif [ $count -ge 10 ] && [ $count -lt 100 ]; then
wget -nv -O 00${count}${locale}.mp3 ${baseUrl}${locale}/SOUND/00${count}.mp3
elif [ $count -ge 100 ] && [ $count -lt 1000 ]; then
wget -nv -O 0${count}${locale}.mp3 ${baseUrl}${locale}/SOUND/0${count}.mp3
else wget -nv -O ${count}${locale}.mp3 ${baseUrl}${locale}/SOUND/${count}.mp3
count=$(( $count + 1 ))


echo “Job done”
Usage: 1. save this script into a file, I called it
2. run ./ EN to download all the english sounds (replace EN with your targeted locale)
3. drag the resulted files in your favourite player and you’re ready to become a polyglot
A few notes for bash beginners:
– pay attention to the spaces between and after [ ], this could drive you nuts
– protect your $variable with ${variable}
– make use of your CLI skills