I wanted to convert some M4A files to MP3, and found some examples of how to do it: Convert iTunes M4A files to MP3 on Linux, and especially Howto:convert aac/mp4 to wav/mp3/ogg on Linux.
The second link was close to what I wanted, and the script almost worked, but I wanted something even simpler, so here is the simplest script that worked for me. It converts all .M4A files in the current directory to MP3.
#!/bin/bash
# Usage: run without arguments from the folder containing M4A files
# Uses faad and lame (sudo apt-get install faad lame)
shopt -s nocaseglob
for file in *.m4a ; do
if [ -e "${file%%.*}.mp3" ]; then
echo "file ${file%%.*}.mp3 already exists! skipping!" ;
continue
fi
faad -o - $file | lame - "${file%%.*}.mp3" ;
done