Xargs: pass in single quote with ls
Handy when using ls and xargs together
ls *.wav -1 | awk 'BEGIN {ORS=""} { print $0"\0" }' | xargs -0 -I{} lame -V0 {} {}.mp3
Breaking it down; the first part will list all the WAV files as a list of just filenames (no path)
ls *.wav -1
Then we tell awk to not print anything at the end of the line, then we ask awk to print each line but append a null character to the end of the line
awk 'BEGIN {ORS=""} { print $0"\0" }'
Finally, we tell xargs to treat the null character (\0) as the end of the line, so it recognises each filename but importantly ignores any special characters on that line
xargs -0 -I{}
It then passes each file to lame to do the encoding at a variable bitrate quality of 2 (the lower the number the higher the quality)
lame -V0 {} {}.mp3