help with 'foreach' command in shell scripting call

Sorry, this isn’t exactly applescript, but if someone could help me that would be great.

I am trying to create a shell script (using zsh) that will be called by applescript.
It will execute the lame encoder on the contents of a folder.

I’ve gotten it to work so far by using:

% foreach file (.wav) result (.mp3)
lame -options $file $result
end

and it works, but it keeps spitting out files that look like:

file.wav.mp3

I don’t know the syntax of the foreach command, so I don’t know how to give it the correct commands.

Thank you in advance for pointing me in the right direction, even it if it is to a different forum :slight_smile: